Linux tip, Fedora tip / howto: ssh pauses a long time before giving the password prompt
ssh pauses a long time before giving the password promptThis was a problem I had when ssh'ing to a Macbook: it would take more than 20 seconds before I'd get the password prompt. Running sshd in debug mode on the Macbook showed the following ("userid" is my user id):
debug1: PAM: initializing for 'userid'
After the 20 second pause it would give:
It turns out this is because PAM is trying to get a host name for the given IP (in this case, 192.168.1.4). This is the fixed IP for my PC, and somehow the DNS of my router doesn't do anything useful.
The fix is to add a line to the /etc/hosts file on the Macbook:
There may be other fixes, maybe to the router. The system.log file on the Macbook claims my router is a "defective DNS relay" ...
use UseDNS no in your sshd configSomeone alerted me to another option: add the line:
to your /etc/ssh/sshd_config file, which prevents the ssh daemon from doing a reverse DNS lookup.