Re: root .bash_profile?

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



On Mon, 2019-05-13 at 16:20 -0400, Bee.Lists wrote:
> > On May 13, 2019, at 2:46 PM, Pete Biggs <pete@xxxxxxxxxxxx> wrote:
> > 
> > > First, the ~ which might not apply to root. 
> > 
> > Why do you think that?  '~' is just shell shorthand for user's home
> > directory.
> 
> root quite often isn’t recognized as a proper user.  ~/.bash_profile
> isn’t loaded because it’s not a normal login shell when entering
> `su`.  

If you switch to any other user using 'su', then their .bash_profile
isn't loaded (unless you specify that it's a login shell).  'su'
doesn't mean "super user" it means "substitute user" - the default
happens to be user UID 0.

> 
> > > 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.
> 
> So I can’t assume it’s just another user.  

It may not be "just another user", but it *is* a user as much as your
login username is a user. You could assign your own username a UID of
0, and it would have the same privileges as 'root', but it would still
act as your username.  NOTE: doing this is NOT recommended, do not do
it, seriously, do NOT do it.

> 
> > > 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.
> 
> Isn’t moving from my own user using su, then prompted for password
> count as a login?  

No. It doesn't. The password prompt is for authentication, not logging
in.

> 
> man su doesn’t apply to root with regards to the files loaded up upon
> login. 

Could you explain what you mean by that.

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