How to Allow|Deny SSH Access To A Particular User|Group In Linux


To Make any changes in ssh we have to edit configuration file in Linux.

File name:
/etc/ssh/sshd_config


After making the any Changes to the above file we have to restart sshd services with below command

service sshd restart



Configuration Changes Examples for User|Groups

1) Allow ssh access from only one user

Edit the ssdd_config file and add|edit below

AllowUsers himanshu

2) Allow ssh access from multiple users 

Edit the ssdd_config file and add|edit below

AllowUsers himanshu bob kevin

3) Allow ssh access from a particular group

AllowGroups dba

4) Deny ssh access from only one user

Edit the ssdd_config file and add|edit below

DenyUsers himanshu

5) Deny ssh access from multiple users

Edit the ssdd_config file and add|edit below

DenyUsers himanshu bob

6) Deny ssh access from group

Edit the ssdd_config file and add|edit below

DenyGroups dba