Friday, February 19, 2010

How to limit ssh login to specific users

By default, SSH will permit every user with an account on the machine on which it runs. You can control access to the server as below.
Open /etc/ssh/sshd_config in your favourite editor (as root). Add the following lines below the authentication section.
AllowUsers user1 user2
This will allow only users user1 and user2 access to login via SSH.
Save the file /etc/ssh/sshd_config and restart ssh.
#/etc/init.d/ssh restart

Ony users user1 and user2 will be able to login via SSH.

No comments: