I was aware that there were such things as login and non-login sessions, I was aware that Ubuntu prevents having a password for root, etc. I wasn’t aware that using sudo was functionally different than login.
And in fact, probably (possibly?) so far it hasn’t been a problem as far as gumming up $LFS, and permissions would be the same generally (I will do another post about the permissions rabbit hole), but it would be why the “for loop from Hell” didn’t work, and probably some other stuff that I’ll see when I go back over old posts about this issue.
OK here’s what I’ve learned.
Terminology
To elevate root permissions: temporarily running commands with the highest level of system access available (root)
To source a file: the referenced file is read and executed
To inherit an environment: retain the current environment
Not 100% sure I have stated that stuff right.
sudo
Elevates root permissions
Behaves like a non-login shell
No shell files are sourced
Inherits current user environment
Retains current working directory
sudo -s
Interactive non-login shell as root
This shell sources ~/.bashrc file of current user
Inherits current user environment
Retains current working directory
sudo su –
Identical results as sudo -i
Interactive login shell as root
Resets to the root environment
Root as working directory
The shell sources these files:
First reads /etc/profile – system-wide login configuration
Next sequentially looks for the first one it finds of the following:
/root/.bash_profile, /root/.bash_login, /root/.profile
In Ubuntu it would find /root/.profile
Which sources /etc/bash.bashrc – system-wide interactive settings
Note: the file I just moved out of the way
And also sources /root/.bashrc – root user’s personal interactive settings
