Enable SSH login to Ubuntu by root user

In Ubuntu 16.04 by default root login by SSH is blocked for security reason. To enable root to login by SSH we have to update the ssh configuration. NOTE: This may make your server insecure for hackers so just enable root login temporarily if needed.

/etc/ssh# ssh root

Permission denied (publickey).

Next edit the file:  /etc/ssh# vi sshd_config

Change the following lines:

PermitRootLogin prohibit-password


PermitRootLogin yes


PasswordAuthentication no


PasswordAuthentication yes

Save the file and restart SSH.

/etc/ssh# service ssh –full-restart

* Stopping OpenBSD Secure Shell server sshd   [OK]

* Starting OpenBSD Secure Shell server sshd     [OK]

Now try and login with ssh with root:

/etc/ssh# ssh root

Password: xxxxxx

Welcome to Ubuntu 16.04.4 LTS

Login was successful.






Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s