How to log in the server as root after setting PermitRootLogin to no in /etc/ssh/sshd_config

April 12, 2018 1.4k views
Ubuntu Getting Started

I have set the PermitRootLogin to no in /etc/ssh/sshd_config by following the tutorial Initial Server Setup with Ubuntu 14.04. Now I cannot log in as root.

How can i log in as root? Thank you.

1 Answer

Once you’ve made and applied this change it will not be possible to connect to ssh as root. You have a couple options to use instead:

  • Log in via SSH with the new user account you created in that tutorial and use sudo to run commands as root or sudo su to launch a shell as root after you are logged in.

  • If for any reason you are not able to log in with the new account, if you are using password authentication (instead of ssh-keys) you can log into the web console in the control panel (Droplet->Access->Console) as root. The console is not powered by SSH. Instead, your droplet sees the console as it’s local keyboard and display.

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!