4 ms·
The article is probably a link-baiting joke, but assuming for a moment that it is not, you can get the same benefits without the requirement to run as root. I
by BrandonM 18y ago
The article is probably a link-baiting joke, but assuming for a moment that it is not, you can get the same benefits without the requirement to run as root.
I don't use sudo to run just any command as root. Making the ability to run a root command as easy as tacking a "sudo" on the front is barely safer that running as root. Especially considering that if someone breaks your user password and you use sudo for everything, they may as well have broken root. Instead, I simply use "su", enter the root password, and have a root terminal. When I'm done, I log back out of the root shell. I also disallow logging in as root over SSH (for whatever reason, this is not the default behavior). Thus, to break root, someone has to break both my user (knowing both the username and the password) and my root password.
This gets old, so I do have sudo installed. You can use sudo to allow a non-root user to run certain commands with root privileges (just be sure NOT to include the
%wheel ALL = (ALL) ALL
line, which is how most people use sudo). For common commands that don't pose much of a security risk, you can add a line as follows to /etc/sudoers:
username ALL = NOPASSWD: /usr/bin/emerge, /usr/sbin/hibernate, [etc.]
Then, in my ~username/.bashrc, I have:
alias emerge="sudo /usr/bin/emerge"
alias hibernate="sudo /usr/sbin/hibernate"
[etc.]
(Note: emerge is basically Gentoo's apt-get, but vastly different, of course.) Thus, from the point of view of a standard user, I can run my most common root commands (with root privileges) as my unprivileged user, transparently. I can be careful to only allow commands that will not compromise my entire machine in the event that someone gains access with my username or I find myself drunk at the terminal.