After finding this Cyberciti.biz article, I started looking into
pam_access. This is the solution I am settling on:
First, I created an access file in
/etc/security/sshd.conf. I chose doing this instead of using the default
/etc/security/access.conf because I wanted an access file dedicated to
sshd. The file looks like this:
# cat /etc/security/sshd.conf
man access.conf for more information on syntax.
Then, I added the following line on top of the PAM stack in
auth required pam_access.so accessfile=/etc/security/sshd.conf
The reason I used
auth instead of
account as done in the Cyberciti.biz article was because using
account type allowed users to verify the password and then get rejected. I rather not verify the password. Check out
man pam.conf for more information.
This worked perfectly.