Interested in only allowing certain users to log in via
ssh? The solution that I used is as follows:
- Open the file /etc/sshd_config in your favorite Terminal text editor (you can edit it with TextEdit as well, but you'll have modify permissions in order to save your changes -- so it's just easier to do sudo vi /etc/sshd_config instead).
- Add the following line to the end of this file:
AllowUsers username1 username2
Replace username1 and username2 with the short usernames of those users who will be able to log in via ssh. You can add as many as you want, separated by spaces.
- Restart the ssh daemon (or, as I did, the computer).
Voila! If anyone attempts to log in via ssh with a username that is not in the list after
AllowUsers, it will be as if they are trying to log in to an account that does not exist.