I keep wondering why sudo su
doesn't source /etc/profile
.
The answer according to this stackoverflow answer is that using su
doesn't act as a login shell.
Only login shells source /etc/profile
.
Here su
won't cause the login to happen:
su
su root
While here it does:
su -
su - root
This means that you can do:
sudo su -
This will put you in superuser while also sourcing /etc/profile
. I'm guessing that crons have this same problem in that they are launching shells without them being login shells.