Linux under SSH remote Connection service Slow solution

Source: Internet
Author: User
Tags comments hmac md5 openssl ssh ssh server


1. The applicable order and plan are as follows:



Remote connection and Execute command



Ssh-p22 root@10.0.0.19



Ssh-p22 Root@10.0.0.19/sbin/ifconfig



"Remote copy: Push and Pull"



Scp-p22-r-p/etc root@10.0.0.19:/tmp/



Scp-p22-r-P root@10.0.0.19:/tmp//etc



"Secure FTP Features"



Sftp-oport=22 root@10.0.0.19



"No Password Authentication scheme"



For example, use Sshkey to bulk distribute files and perform deployment operations.



2, the main reason for the slow connection is that DNS resolution causes



Workaround:



1. Change the configuration in the/etc/ssh/sshd_config file on the SSH server as follows:



Usedns No



# GSSAPI Options



Gssapiauthentication No



Then, perform the/etc/init.d/sshd restart restart sshd process so that the configuration takes effect, and the connection is generally not slow.






2, if it is slow, check the SSH service end of the/etc/hosts file, 127.0.0.1 the corresponding host name and



Uname-n results, either native IP and hostname (UNAME-N results) are added to the/etc/hosts.


[ROOT@C64 ~]# uname-n C64 root@c64 ~]# cat/etc/hosts
#modi by
oldboy   11:12 2013/9/24 C64 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: 1         localhost Localhost.localdomain Localhost6 localhost6.localdomain6
10.0.0.18   C64
################


3, the use of Ssh-v debugging features to find slow reasons



In fact, you can use the following command to debug why slow details (learning this idea is very important).


[root@C64 ~]# ssh -v root@10.0.0.19
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
Debug1: Reading configuration data /etc/ssh/ssh_config
Debug1: Applying options for *
Debug1: Connecting to 10.0.0.19 [10.0.0.19] port 22.
Debug1: Connection established.
Debug1: permanently_set_uid: 0/0
Debug1: identity file /root/.ssh/identity type -1
Debug1: identity file /root/.ssh/id_rsa type -1
Debug1: identity file /root/.ssh/id_dsa type -1
Debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
Debug1: match: OpenSSH_4.3 pat OpenSSH_4*
Debug1: Enabling compatibility mode for protocol 2.0
Debug1: Local version string SSH-2.0-OpenSSH_5.3
Debug1: SSH2_MSG_KEXINIT sent
Debug1: SSH2_MSG_KEXINIT received
Debug1: kex: server->client aes128-ctr hmac-md5 none
Debug1: kex: client->server aes128-ctr hmac-md5 none
Debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
Debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
Debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
Debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
The authenticity of host '10.0.0.19 (10.0.0.19)' can't be established.
RSA key fingerprint is ca:18:42:76:0e:5a:1c:7d:ef:fc:24:75:80:11:ad:f9.
Are you sure you want to continue connecting (yes/no)? yes
=======> Old Boy Teacher Comments: Here is the interactive prompt to save the key.
Warning: Permanently added '10.0.0.19' (RSA) to the list of known hosts.
Debug1: ssh_rsa_verify: signature correct
Debug1: SSH2_MSG_NEWKEYS sent
Debug1: expecting SSH2_MSG_NEWKEYS
Debug1: SSH2_MSG_NEWKEYS received
Debug1: SSH2_MSG_SERVICE_REQUEST sent
Debug1: SSH2_MSG_SERVICE_ACCEPT received
Debug1: Authentications that can continue: publickey, password
Debug1: Next authentication method: publickey
Debug1: Trying private key: /root/.ssh/identity
Debug1: Trying private key: /root/.ssh/id_rsa
Debug1: Trying private key: /root/.ssh/id_dsa
Debug1: Next authentication method: password
Root@10.0.0.19's password:
=======> Old Boy Teacher Comments: Here is the interactive prompt for entering a password.
Debug1: Authentication succeeded (password).
Debug1: channel 0: new [client-session]
Debug1: Entering interactive session.
Debug1: Sending environment.
Debug1: Sending env LANG = en_US.UTF-8
Last login: Tue Sep 24 10:30:02 2013 from 10.0.0.18
If you are slow at the remote connection, you can determine where the card is.
[root@C64_A ~]# ssh -v oldboy@10.0.0.17
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
Debug1: Reading configuration data /etc/ssh/ssh_config
Debug1: Applying options for *
Debug1: Connecting to 10.0.0.17 [10.0.0.17] port 22.
Debug1: Connection established.
Debug1: permanently_set_uid: 0/0
Debug1: identity file /root/.ssh/identity type -1
Debug1: identity file /root/.ssh/id_rsa type -1
Debug1: identity file /root/.ssh/id_dsa type 2
Debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
Debug1: match: OpenSSH_5.3 pat OpenSSH*
Debug1: Enabling compatibility mode for protocol 2.0
Debug1: Local version string SSH-2.0-OpenSSH_5.3
Debug1: SSH2_MSG_KEXINIT sent
Debug1: SSH2_MSG_KEXINIT received
Debug1: kex: server->client aes128-ctr hmac-md5 none
Debug1: kex: client->server aes128-ctr hmac-md5 none
Debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
Debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
Debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
Debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
Debug1: Host '10.0.0.17' is known and matches the RSA host key.
Debug1: Found key in /root/.ssh/known_hosts:2
Debug1: ssh_rsa_verify: signature correct
Debug1: SSH2_MSG_NEWKEYS sent
Debug1: expecting SSH2_MSG_NEWKEYS
Debug1: SSH2_MSG_NEWKEYS received
Debug1: SSH2_MSG_SERVICE_REQUEST sent
Debug1: SSH2_MSG_SERVICE_ACCEPT received
Debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
Debug1: Next authentication method: gssapi-keyex
Debug1: No valid Key exchange context
Debug1: Next authentication method: gssapi-with-mic


The above configuration is not matched to find the card to gssapi this. I probably know it's a gssapi problem.



In fact, you should optimize the SSH service here in the Linux System Optimization section.



This article is from the "Old boy Linux operation" blog, please be sure to keep this source http://oldboy.blog.51cto.com/2561410/1300964



See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/


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.