On Ubuntu and some other distributions direct login to root is disabled and sudo has to be used. The idea is to discourage running as root as this is bad for security (just like running as administrator in Windows). It is possible to get to a root shell but there is a right way and wrong way to do it. The wrong way doesn't change the environment variables like $HOME which will cause programs like Midnight Commander to save their config files to the originating user's home directory but with root ownership.
This is the WRONG way which leaves $HOME still set to the originating user's home:
sudo -s (or) sudo /bin/sh
This is the correct way which sets $HOME to /root:
sudo su (or) sudo su - (or) sudo -i
To experiment, enter the above commands followed by "echo $HOME". Enter "exit" to return to the original shell.
No comments:
Post a Comment