As what we wrote in the previous article on how to allow SSH root on Ubuntu 14.04, after installing a fresh new copy of Ubuntu 16.04 LTS, we find that once again (for better security) ssh root access has been configured to “prohibit-password” by default. This prevents root login via SSH.
You would have to change the empty root password to login directly. Personally, I strongly suggest you login to root through your sudo account with sudo -i.
The following steps will explain how to Enable SSH Root Login on Ubuntu 16.04.
1. How to enable root password ?
ehowstuff@ubuntu16:~$ sudo passwd root Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
2. How to Enable SSH Root Login on Ubuntu 16.04 (sshd_config -> change permitrootlogin to yes)
Open sshd config file :
# vi /etc/ssh/sshd_config
Comment out and add the following line :
.. # Authentication: LoginGraceTime 120 PermitRootLogin prohibit-password StrictModes yes ..
.. # Authentication: LoginGraceTime 120 #PermitRootLogin prohibit-password PermitRootLogin yes StrictModes yes ..
3. Finally, apply the changes by restart or reload sshd service :
# systemctl restart sshd