Installing Sudo and Adding a User
by Mike Levin SEO & Datamaster, 08/25/2010
Okay, first thing is to get the sudo program, which will also set up /etc/sudoers, the file that controls permissions.
apt-get install sudo
So let’s make our user:
useradd inmate -d /home/inmate
…and set its password:
…and now we run visudo, a program that’s installed with sudo specifically to help ensure that the edits made to /etc/sudoers is valid. Apparently, the sudoers file is complicated enough that its creators felt it necessary to envelop editors in a syntax-checker. They happened to have chosen nano for that text editor, since it’s rude to suddenly drop someone into vi if they’re not expecting it. So, type:
…now, down-arrow to right underneath where you see “root ALL=(ALL) ALL” and type:
inmate ALL=(ALL) ALL Ctrl+X Y [Enter]
Now, restart your system:
shutdown -r now
Okay, it’s actually important now to be able to successfully log in with your new user account and promote it to root before disabling the password for the actual root user, or else you’ve pretty much screwed yourself and lost your work up to your last backup. You have backed up, right?
Once you’re satisfied that you have root privileges with your new user (the # at the end of the prompt), you can now remove the root password with this command:
passwd -l root
Now a hacker can spend all day trying to crack the root password, and never have any knowledge that there is not one set. Ha ha ha!