- First login as a root user.
- Then edit the sshd_config file by provided command which is in /etc/ssh/sshd_config Directory
nano /etc/ssh/sshd_config
- 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
- After that save the changes that you have made in upper step /etc/ssh/sshd_config file.
- 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.