How to Enable Root Login Via SSH on CentOS 7

Apr 01, 2024

To enable root login via SSH on CentOS 7, follow these steps:

Step 1 : Check SSH status

sudo systemctl status sshd

Step 2 : Edit sshd_config

sudo nano /etc/ssh/sshd_config

Step 3 : Uncomment and set PermitRootLogin to yes

PermitRootLogin yes

Step 4 : If you want to login using a password, edit PasswordAuthentication to yes

PasswordAuthentication yes

Step 5 : Set root password if not already active

passwd root

Step 6 : Restart SSH service

sudo systemctl restart sshd

Step 7 : Test Connection

ssh root@your_server_ip

Congratulations! You have successfully enabled root login via SSH on CentOS 7.