SSH server is by default configured to perform reverse DNS lookup every time you try to log in to the server. It cloud slightly improve logging and security, but could significantly increase login time.

Basically, the login prompt will take a while to appear as the server will perform reverse DNS lookup prior to presenting the login prompt to the connecting user.

You can fix this issue by setting the UseDNS directive to no on the SSH server at the terminal.

Specifies whether sshd(8) should look up the remote host name and check that the resolved host name for the remote IP address maps back to the very same IP address. The default is “yes”.

Disable reverse DNS lookup in SSH:

  1. Launch terminal application.
  2. Open SSHd configuration file using a text editor.
    $ sudo vi /etc/ssh/sshd_config
    [sudo] password for user:
  3. Search for UseDNS directive and set the value to no.
    UseDNS no

    Add the line if it doesn't already exist and remove the # at the beginning of the line if exists.

  4. Reload or restart SSH server service.
    $ sudo systemctl restart sshd

Guide compatibility:

Operating System
Ubuntu Linux
Debian Linux
Red Hat Enterprise Linux
Fedora Linux
CentOS Linux
openSUSE Linux
SUSE Linux Enterprise Server
Leave a comment: