Solution to slow ssh login in CentOS

Source: Internet
Author: User

Solution to slow ssh login in CentOS
I believe many of my friends have abandoned telnet rlogin or X-window for security reasons when using the Linux system, and used openssh as their default remote logon method.

However, it is often the case that telnet to the server is fast, but the ssh connection is slow. It takes about half a minute or longer. Ping speed is also very good, people mistakenly think that the ssh connection is not good.

The following describes how to solve this problem,

The most common reason is that the server's sshd will go to the DNS to find the hostname for accessing the client IP address. If the DNS is unavailable or there are no relevant records, it will take a lot of time.

1. Add the ip address and hostname of your local machine to the/etc/hosts file on the server.

2. modify or add UseDNS = no to the/etc/ssh/sshd_config file on the server.

3. Comment out all rows in/etc/resolv. conf on the server.

4. Modify hosts in/etc/nsswitch. conf on the server to hosts: files.

5. reboot server to make the configuration take effect

In addition

Authentication gssapi-with-mic

There may also be problems. Modify GSSAPIAuthentication no in the/etc/ssh/sshd_config file on the server.

/Etc/init. d/sshd restart sshd process to make the configuration take effect

If the above two methods do not solve the problem, we are good at using the debug mode ssh-v to view the log, find the process with the longest suspension time, and then modify the configuration accordingly.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.