Restrict ssh access

A way to secure your Linux box is to restrict ssh access.
The ssh server configuration file in most Linux distribution is located at: /etc/ssh/sshd_config
Note: The client system-wide configuration is located at /etc/ssh/ssh_config

1. Change the ssh port

Open sshd_config with an editor and uncomment and change this line:

#Port 22

Change the number to a different port you'd like to use.


2. Restrict root access.

Note: Some UNIX based OS's like solaris, openindiana, opensolaris, and the BSD's disable root access by default. 

Uncomment this line and change its attribute to "no"

#PermitRootLogin yes

3. Allow only specific users 

If you want to allow only user1 and user2 to access the server via ssh, add this line to sshd_config 
AllowUsers user1 user2 

Ssh needs to be restarted for any changes to take effect.