Fixing slow SSH logins
On a fresh VPS, logging in over SSH took around ten seconds before the password prompt appeared. Once connected, everything was fast. That pattern almost always means the server is waiting on a lookup that times out.
Find where it stalls
Run the client in verbose mode and watch where the output pauses:
ssh -vvv user@host
In my case the pause came right after SSH2_MSG_SERVICE_ACCEPT, while it was trying gssapi-with-mic. That's the client attempting Kerberos authentication, which nobody uses on a hobby box.
The two usual culprits
GSSAPI. Turn it off on the client, for all hosts or per host, in ~/.ssh/config:
Host *
GSSAPIAuthentication no
Reverse DNS on the server. If sshd tries to resolve the client's IP and the resolver is slow, every login waits for it. In /etc/ssh/sshd_config:
UseDNS no
Recent OpenSSH already defaults to no, but older images and some provider templates still set it to yes. Check with:
sshd -T | grep -i usedns
Then reload:
systemctl reload ssh
Result
Login dropped from about ten seconds to well under one. If neither of these helps, check /etc/resolv.conf on the server. A dead nameserver listed first makes everything that does DNS slow, not only SSH.