You may notice on some systems you build that when you SSH into them, there seems to be a long delay before the system prompts you for your password. In a time-sensitive situation, this gets real frustrating, real fast.
Here’s how to fix it.
The issue is caused by the box you are SSHing into trying to resolve your IP address to a DNS name for the logs. We don’t really need this (especially for non-public servers), so we may as well disable it, drastically speeding up the time it takes for the box to prompt you for your password in the process (so drastic it becomes instant, in fact).
- Login to your box as normal via SSH.
- Type in at the dollar prompt:
$ sudo nano /etc/ssh/ssh_config
- A text editor showing you the SSH server config will appear. Scroll right to the very bottom of the file.
- Now add the following line in (indent it to match the existing lines with a few spaces at the front):
- Save your changes by pressing CTRL+X, then “Y” and then Enter.
- Restart the SSH server with the following command (won’t affect your existing session):
$ sudo service ssh restart
- Log out and test logging in via SSH again. This time the password prompt will appear immediately.
- Pat yourself on the back. You’re done.
This fix applies to any version of Ubuntu (or just about any distro, for that matter).