For example, to allow users, amos and admin to login, edit the SSHd configuration file and add the line below;
vim /etc/ssh/sshd_config
...
AllowUsers amos admin
Once changes are made, restart SSH.
systemctl restart ssh
Now, if you try to login as any other user apart from the two allowed above, you should get permission denied.