inside Alan's cluttered head
Archive for April 30, 2012
‘sudo’ vs using a root password
0
13 years
There seems to be a lot of confusion about the use of “sudo” vs using a root password. It’s a lot simpler than many make it out to be.
- On a system that uses a root password, all administrators use a shared root password.
- On a system that uses “sudo”, all administrators use their own passwords.
- There is no reason why you can’t do both.
Some people argue about a Linux distribution’s default setting, when they could simply change the setting after installation and forget about it.
- To enable a root password:
$ sudo passwd root
- To disable a root password:
$ sudo passwd -l root
- To start using sudo:
# apt-get install sudo
# adduser username sudo - To stop using sudo:
# gpasswd -d username sudo
(optional)
# apt-get remove --purge sudo - To run a “su-like” shell using “sudo”:
$ sudo -s
(runs a normal shell)
or
$ sudo -i
(runs a login shell)
Personally, I have gotten used to disabling my root password and the using either sudo -i
or ssh root@hostname
. That’s one less password for me to remember, and one less password that can be probed on the network.
But you don’t have to be like me… you do what feels right to you!