Purpose Behind Disabling PAM in SSH
I think that people who recommend disabling UsePAM
may not understand completely the services provided by the PAM stack. In addition to authentication, PAM
also provides session setup services that you may not want to bypass.
Examples include setting resource limits (via pam_limit
), environment variables, and mounting directories.
If it makes you more comfortable you can modify the PAM
configuration for sshd
such that it does not support password authentication of any sort. Assuming that you have an existing /etc/pam.d/sshd
, just remove the existing auth
lines and replace them with:
auth required pam_deny.so