SSH connection Slow

Source: Internet
Author: User

Because many people reflect the company test environment Server SSH connection is very slow, to troubleshoot the ping does not drop packets, that is the problem of system configuration. Search on the Internet, the results are very practical.


First, the cause of the investigation


Before testing :

Ssh-v 192.168.1.138

Then there will be a lot of bugs

For example:

Debug1:next Authentication Method:gssapi-keyex

Debug1:no Valid Key Exchange context

Debug1:next Authentication Method:gssapi-with-mic

Debug1:unspecified GSS failure. Minor code may provide more information

Credentials cache file '/tmp/krb5cc_0 ' not found


Debug1:unspecified GSS failure. Minor code may provide more information

Credentials cache file '/tmp/krb5cc_0 ' not found


Debug1:unspecified GSS failure. Minor code may provide more information



Debug1:unspecified GSS failure. Minor code may provide more information

Credentials cache file '/tmp/krb5cc_0 ' not found


Debug1:next Authentication Method:publickey

Debug1:trying private key:/root/.ssh/identity

Check the connection time:

Time ssh [email protected] Exit

Real0m4.785s

User0m0.014s

SYS0m0.011s

Second, configuration optimization


1. Turn off DNS reverse resolution

In Linux, the SSHD service is turned on by default for DNS resolution. It consumes time, so it needs to be closed.

Vim/etc/ssh/sshd_config

Usedns No

Although it is commented out, the default is yes.


Time ssh [email protected] Exit


Real0m3.978s

User0m0.016s

SYS0m0.010s


See the actual connection time significantly reduced a lot. The explanation played a role!


2. Turn off authentication for server

During the authority process, gssapi-with-mic can be a big problem, so shutting down the GSSAPI increases the speed.


Vim/etc/ssh/sshd_config

Gssapiauthentication No

Save launch

Time ssh [email protected] Exit

Real 0m3.832s

User 0m0.011s

SYS 0m0.004s

The time was significantly reduced by a lot. Basically, it can be used normally.



This article from "The Dark before Dawn" blog, declined reprint!

SSH connection Slow

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.