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.
Step3: Add or modify the following lined as per the requirements.
To allow SSH Access to a user,
To allow SSH Access to a group,
To deny SSH Access to a user,
To deny SSH Access to a group,
Here and need to be replaced with the corresponding values.
Step4: Restart SSH service.
#systemctl restart sshd