TECHIES WORLD

For Techs.... Techniques.... Technologies....

BashLinux

How to deny or allow SSH access to user and group

We can allow or deny SSH access to user and group by some changes in configurations.

This article explains the modifications required in detail.

Step1: Login to the server as root via ssh.

Step2: Open the sshd configuration file.

#vi /etc/ssh/sshd_config

Step3: Add or modify the following lined as per the requirements.

To allow SSH Access to a user,

AllowUsers <username>

To allow SSH Access to a group,

AllowGroups <groupname>

To deny SSH Access to a user,

DenyUsers <username>

To deny SSH Access to a group,

DenyGroups <groupname>

Here and need to be replaced with the corresponding values.

Step4: Restart SSH service.

#systemctl restart sshd

That's all…

Leave a Reply