Your Gateway To Digital Success
Wesbytes Blue Logo

Wesbytes Knowledge Base

Search our articles or browse by category below

Enable Root Login via SSH

Last modified: July 2, 2022
You are here:
Estimated reading time: 1 min

By default, SSH comes configured in a way that disables root user logins. This is done as a security precaution and means that you cannot directly log in as the root user over SSH. Fortunately, you can usually get around the need for root ssh login by using the sudo command. In some cases, though it’s just more convenient to get directly logged in as root.

Linux VPS Server

Enable Root Login Over SSH

Step 1

First of all, as the root user, edit the sshd_config file found in /etc/ssh/sshd_config:

vim /etc/ssh/sshd_config

Step 2

Next, add the following line to the file, you can add it anywhere but it’s good practice to find the block about authentication and add it there.

PermitRootLogin yes

Step 3

Then, save and exit the file.

Step 4

Lastly, restart the SSH server:

systemctl restart sshd


service sshd restart

That’s it! With the new line added and the SSH server restarted you can now connect via the root user. In this instance, you’re gonna be able to login with the root user with either the password or an ssh key.

Extra Security

For extra security, you can set the value to `without-password` instead of yes. So you would paste in the following in step 2 instead:

PermitRootLogin without-password
This process should work on pretty much any Linux based server with the ssh server installed. If you are using a cPanel server though you can easily control this setting from the WHM interface. In these cases, it’s recommended to control this setting from your control panel interface.

Was this article helpful?
Dislike 0
Views: 29