Sunday, January 06, 2008

How to disable root access from ssh

By default, usually ssh allow us to login as root. If we are concerned a lot about security, we'll want to disable root access from ssh. Belows are steps to disable direct root access from ssh:

  1. login to your server, and gain root access (by sudo or su - )

  2. Edit ssh configuration file. Usually the file is located at /etc/ssh/sshd_config

  3. Find the line: PermitRootLogin yes, then replace the line into: PermitRootLogin no

  4. If you'd like to only enable protocol version 2, find the line: Protocol 2,1 then replace it into: Protocol 2

  5. Save the files

  6. restart ssh:
    /etc/rc.d/init.d/sshd restart

That's all :)

1 comment:

  1. This comment has been removed by a blog administrator.