Enable/Disable SSH For Root User


Sometimes for any reason you want to enable root ssh using any SSH Client such as putty and only the administrator can login to do this follow the below steps :-

vi /etc/ssh/sshd_config
search for line as follow :-
PermitRootLogin yes and change it to –> PermitRootLogin no
Search for the following lines as well :-
DenyUsers root user2 user3
Remove the root from Deny User
DenyUsers user2 user3
/etc/init.d/sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]

If you want to disable the SSH login for root just keep everything like the above.