Showing posts with label allow ssh to specific users. Show all posts
Showing posts with label allow ssh to specific users. Show all posts

Friday, July 4, 2014

Allow / Block ssh / sftp for specific Users / Group

Allow ssh / sftp to selected users
If you want to give ssh / sftp privileges to certain users, here is the solution.
Add following line in the file /etc/sshd_config
AllowUsers username1 username2 username3
If you want to allow certain groups only, add following line in /etc/sshd_config
AllowGroups username1 username2 username3
Restart service ssh.

Block ssh / sftp for selected users
If you want to restrict certain users to access ssh / sftp, here is the solution.
Add following line in the file /etc/sshd_config
DenyUsers username1 username2 username3
If you want to block certain groups only, add following line in /etc/sshd_config
DenyGroups username1 username2 username3
Restart service ssh.