SSH restrict access to user or group

When you have a public Linux server with Open SSH installed you will often find in you security logs failed login attempts from deferent ip’s most of them are hackers trying to brute force user accounts, one of security measures that can be added to Open SSH server is to restrict access to a specific user or specific group for example to allow user roger only to login to ssh you add the following line to /etc/ssh/sshd_config

AllowUsers roger

to restrict access to admin group add the following line

AllowGroups admin

3 thoughts on “SSH restrict access to user or group”

  1. Yes is much better to switch to key-based authentication as long as you don’t lose the key or you have KVM access to the server :)

  2. I always use key-based authentication but never bother to disable password logins (as Roger says, in case there is a problem with the keys).

    I do however lock down my SSH ports with iptables.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>