• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
The Electric Toolbox Blog

The Electric Toolbox Blog

Linux, Apache, Nginx, MySQL, Javascript and PHP articles

  • Applications
  • FCKEditor
  • Apache
  • Windows
  • Contact Us
Home / Prevent hostname lookups with openssh sshd

Prevent hostname lookups with openssh sshd

When you connect to an OpenSSH sshd server, it is configured by default to do a hostname lookup on your IP address. If there are any issues with the DNS configuration on the host machine, or with the DNS server it is using, this can lead to a delay when logging in using ssh for around 30 seconds. It is very easy to switch this host name lookup function off in the sshd_config file.

On most Linux distributions, the sshd_config file will be at /etc/ssh/sshd_config, so it’s simply a matter of editing it with your favourite editor as root or using “sudo” and adding the following:


UseDNS no

This is correct for recent versions of sshd but older versions might use the following configuration option instead (I found this on a couple of sites while doing some additional research for this article):


VerifyReverseMapping yes

You can always check the sshd_config options by having a look in the manual by issuing the command man sshd_config.

After making the above change to the configuration file, it’s simply a matter of reloading the SSH daemon. On RedHat and CentOS you would do service sshd reload; /etc/init.d/sshd reload should work on most Linux distributions.

Please note that making this change may introduce a security risk as full checking is no longer done on the hostname and IP address. Note this from the manpage:


UseDNS - Specifies whether sshd 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".

Check Out These Related posts:

  1. Ubuntu enable ssh
  2. Scp command
  3. How to log into an SSH Server Using PuTTY
  4. Changing exim4 settings with Debian 5 Lenny

Filed Under: Linux/Unix/BSD, Networking

Primary Sidebar

Categories

  • Apache
  • Applications
  • Article
  • Case Studies
  • Email Servers
  • FCKEditor
  • HTML And CSS
  • Javascript
  • Linux/Unix/BSD
  • Microsoft SQL Server
  • Miscellaneous Postings
  • MySql
  • Networking
  • Nginx Web Server
  • Offsite Articles
  • OSX
  • PHP
  • Quick Tips
  • RFC – Request for Comments
  • SilverStripe
  • VMWare
  • VPN
  • Windows
  • WordPress

Recent Posts

  • Vim Show Line Numbers
  • Add User To Group Linux
  • Chmod 777 Tutorial
  • How to Copy Directory Linux
  • Linux create user

Copyright © 2021. ElectricToolBox. All Rights Reserved.

  • Contact Us
  • Copyright Info
  • Privacy Policy
  • Sitemap