How to turn off UseDNS to speed up SSH login

  

Frequently logged in to SSH friends can feel that every time you log in to SSH, you have to pause and wait for it to connect. This is because OpenSSH server has a DNS lookup option. UseDNS is by default opened. When the UseDNS option is turned on, when the client attempts to log in to the SSH server, the server first performs a DNS PTR reverse query based on the client's IP address to query the client's host name, and then performs a DNS forward A record based on the queried client host name. Query, verify whether it is consistent with its original IP address, this is a measure to prevent client spoofing, but generally we do not have PTR records for dynamic IP. Opening this option is just a waste of time, it is better to turn it off.

First, edit the file
vim /etc/ssh/sshd_config


Second, find the following characters
#UseDNS yes


Create a new line below it, fill in
UseDNS no


Three, save and restart SSH
service sshd restart


A simple step is done.

Copyright © Windows knowledge All Rights Reserved