The SSH protocol (also referred to as Secure Shell) is a method for secure remote login from one computer to another. It provides several alternative options for strong authentication, and it protects the communications security and integrity with strong encryption. It is a secure alternative to the non-protected login protocols (such as telnet, rlogin) and insecure file transfer methods (such as FTP).

Note: For security purposes, it is always advisable to disable Root Login over SSH

To Enable root login over SSH:

As root user, open the /etc/ssh/sshd_config. Locate the PermitRootLogin as shown below.

sudo nano /etc/ssh/sshd_config

As shown in the screenshot above, PermitRootLogin is currently set to No which means root login via SSH has been disabled. To enable root login, change the No to Yes as shown below:

Save the file before closing.

Next, restart the SSH server by issuing the command below:

 sudo service sshd restart


 sudo systemctl restart sshd

To Disable Root Login, set the PermitRootLogin to No as shown below

Save the file then restart the ssh service.

If you want to keep SSH root login disabled, you need to add a user (or create a new user) and make that user belong to the wheel group (that grants the user sudo access). For more information, read this guide on User Management for Ubuntu and CentOS