How to Enable root login over SSH?

  • 49


  1. First login as a root user.
  2. Then edit the sshd_config file by provided command which is in /etc/ssh/sshd_config Directory  

nano /etc/ssh/sshd_config

  1. Now add a line in the Authentication section of the file that says PermitRootLogin yes. In some cases, this line may already exist and started with a "#". In this case, remove the "#" from start like given below.

# Authentication:

#LoginGraceTime 2m

PermitRootLogin yes

#StrictModes yes

#MaxAuthTries 6

#MaxSessions 10

  1. After that save the changes that you have made in upper step /etc/ssh/sshd_config file.
  2. In the end Restart the SSH server by given command to apply changes.

service sshd restart

You can now connect to the server as root over SSH.



Was this answer helpful?