After setting up SSH key-based authentication, people are advised to disable SSH password authentication.
This is done by navigating to /etc/ssh/sshd_config
and making sure that the following line is not commented out:
PasswordAuthentication no
Some tutorials, e.g.
recommend also setting
UsePAM no
After doing that, I have noticed that I no longer get session notifications from the host. For example when I want to shutdown/reboot it, the terminal hangs and I no longer get:
Connection to 192.168.0.3 closed by remote host.
Connection to 192.168.0.3 closed.
I have read here that one should "probably want to keep it on". Furthermore it may actually help you get safer.
Questions:
- How precisely does
UsePAM no
contribute to security? - Can I somehow still get the session status if I disable
UsePAM
?
I copy past the comment in the default confiugration file
for those reason disabling only PasswordAuthentication and ChallengeResponseAuthentication let pam to be setup to handle account and session staff I copy past what those modules type are meant for
you could check the pamd configuration file in etc/pam.conf etc/pam.d/* and doucle check what modules do. Furthermore the connection termination message does not seem to be related to pam configuration... it's sent by sshd specifically in clientloop.c function client_loop
in my case it prints that message no matter the value of UsePAM.