Secure Access via ssh (Basic)

The following procedure provides good first level security to any machine that utilizes ssh as the primary access method.

1) Open the sshd configuration
vi /etc/ssh/sshd_config

2) Disable root logon
Find the PermitRootLogin property and make sure that is un-commented and set to no. This will prevent anybody from logging in as root even if they know the root password.
PermitRootLogin no

2) Enable only selected users for ssh logon

Find the AllowUsers property and make sure it is un-commented and that only the users that you trust to log onto the machine is listed here seperated by spaces.
AllowUsers {user1} {user2}

3) Move the sshd port to one other than 22

By default the sshd runs on port 22. Many vulnerability sniffers know this and runs on a set set of ports, usually on ports below 1024. So find the Port property and change it to something other than 22 (Preferably above 1024).
Port {port}

4) Close the config file and save

5) Restart sshd
/etc/init.d/ssh restart

6) Confirm that sshd is running on the selected port
netstat -a grep {port}

tcp6 0 0 *:{port} *:* LISTEN
And thats it.

No comments:

Post a Comment