Disable SSH for non root users
Everyone is doing this the hard way.. he said deny for all non-root users.. so just edit
/etc/ssh/sshd_config
Add the following
AllowGroups wheel root
Then restart ssh
Anyone in the wheel or root group will be allowed to ssh in
Several possibilities:
-
/bin/false
as login shell for the normal users in /etc/passwd - Add only root to
AllowUsers
in /etc/ssh/sshd_config
Can use PAM as well:
cp /etc/security/access.conf /etc/security/sshd.conf
echo "+ : root : ALL" >> /etc/security/sshd.conf
echo "- : ALL : ALL" >> /etc/security/sshd.conf
Then modify /etc/pam.d/sshd to add the following line after the other accounts:account required pam_access.so accessfile=/etc/security/sshd.conf
This will also allow you to restrict by network if you decide to do so in the future.