Re: root .bash_profile?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



> ~/.bash_profile
>               The personal initialization file, executed for login shells
> 
> First, the ~ which might not apply to root. 

Why do you think that?  '~' is just shell shorthand for user's home
directory.

>  Second, it’s a “personal” init file, which also might not pertain to
> root.  

root is just as much a user as anyone else, albeit one with special
privileges because they are UID 0.

> Going from user to root (su) might not initiate a login shell.  I’m
> not clear on this. 

Are you logging in? (i.e. typing the username and password at a login
prompt.)  If not, then it's not a login shell.

> 
> But, .bash_profile is not loading.
> 
> I have my aliases in another file called /root/.bash_aliases, which
> is a duplicate of my /home/myuser/.bash_aliases which is NOW sourced
> in my /root/.bashrc so it now works.
> 
> So ya, got it to work, but knowing the cascade of inclusions is
> important.  root is as important to me as my normal user.  
> 

Yes. If you are going to be playing around as root, then you really
should know the consequences of what you are doing.  When I started
using Unix 30mumble years ago, the perceived wisdom was *always* invoke
su as /bin/su, those where the days when '.' was frequently in a users
path and some nasty user might leave scripts called 'su' lying around
waiting for an admin to occidentally execute them.  Second, invoke it
as '/bin/su -', that way you clean out any user variables and only have
the environment you have setup for root.

P.


_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux