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.

Cheers
Osama Mustafa

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.