Allow or Deny SSH access only to a list of users or groups
vi /etc/ssh/sshd_configAllow access for users:
AllowUsers user1 user2 user3Allow access for groups:
AllowGroups group_name
You could also use:
DenyUsers user1 user2 user3
DenyGroups group_nanmeRestart SSH Service:
systemctl restart sshd