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

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.

Submit an answer

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!

Sign In or Sign Up to Answer

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.