I love Linux and everything she stands for; however, unfortunately I grew up with Windows. Thusly so I have learned very bad practices (such as NT Authority will protect me). I have several Linux VPS's for personal and educational uses and I manage all of them from the command line. Through the management of these servers I have learned very painful lessons of the power of the Root user. Such as:
- rm -d -R /*
- chown www-user:www-user -R /*
- Etc.
I've only removed my root directory twice, but just last week I changed the permission of the whole drive - effectively locking the Root out.
Now I know that I should never be logged in as Root, but most of the time I have to deal with files that only the Root owns so I sudo and run the command.
So my question is, is there a way to prompt the user (who is root, or sudo'ed) when a potentially hazardous command is executed, so the user may rethink their decision? Possibly through scripts in Bash, or a different sudo wrapper.
Or (I ask this hopefully, and very simplified) is there a way to set up permissions where instead of a two tier user system (Root user, regular user) there is a three tier system like in Windows (NT Authority, Administrator, other User). Basically is there a way to keep the ability of System administration, but restrict access to some system files.
visudo
file (as root typevisudo
) add the group to allow specific sudo commands. That at least somewhat gets you there. That doesn't warn you that you are about to do something stupid, but I think if you are prompted for your password to run a command, you should make sure you know what it's doing.