A problem with the DNS configuration on a server can cause the login to the ssh server very slow. I can be fixed by adding the following line

UseDNS no

in the ssh server configuration fileĀ /etc/ssh/sshd_config