By default, ssh server performs a reverse DNS lookup for authentication requests. This can be so annoying as you wait ten’s of seconds for the lookup to finish. You may experience a delay before receiving a password prompt while accessing a remote system via ssh.

This guide will show you how to disable SSH reverse DNS lookups in a Linux/Unix system. The method discussed here works for all Linux and Unix based operating systems running OpenSSH Server.

To disable reverse DNS lookup, open OpenSSH server configuration file:

sudo nano /etc/ssh/sshd_config

And setting the line:

UseDNS no

This directive tells sshd service to ignore checks for resolved hostname IP address if it maps back to the same ip address or not. Please note that this does not prevent sshd server from performing any DNS lookups.

Restart sshd service after making the change:

# Systemd
$ sudo systemctl restart sshd

# SysVinit/Upstart
$ sudo service sshd restart

If you still experience delay in SSH, consider disabling GSSAPIAuthentication if is active.

GSSAPIAuthentication no

Then restart sshd service.

# Systemd
$ sudo systemctl restart sshd

# SysVinit/Upstart
$ sudo service sshd restart

More articles:

How To Set Up Two factor (2FA) Authentication for SSH on CentOS / RHEL

Easy way to Create SSH tunnels on Linux CLI

How to change or update SSH key Passphrase on Linux / Unix

Installing sshfs and using sshfs on Ubuntu / Fedora / Arch / CentOS

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!


As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.

LEAVE A REPLY

Please enter your comment!
Please enter your name here