Report this

What is the reason for this report?

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

Posted on April 12, 2018

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.



This textbox defaults to using Markdown to format your answer.

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

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.