Disabling SSH Login for the Root User

May 10, 2014

Login to your server as a user with sudo capabilities.

Once logged it, you will want to edit the /etc/ssh/sshd_config file with your favorite editor to prevent root access (I chose nano):

sudo nano /etc/ssh/sshd_config

Look for the line that contains PermitRootLogin yes and change it to the following:

PermitRootLogin no

Save your changes and then restart SSH:

/etc/init.d/ssh restart

Add New Sudo User on Ubuntu Using Command Line

May 10, 2014

First start by creating the user from your root account (This command will prompt you for the password and other user related information):

root@yourdomain.com:~# adduser username

Next type the following command and hit Enter:


Now look for the section where you see root ALL=(ALL:ALL) ALL. We want to duplicate this line for our new user we just created so the type the following just below that line and save your changes:

username ALL=(ALL:ALL) ALL

Now login as your new user:

ssh username@your_server_ip_address