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