Linux under SSH remote Connection service Slow solution

Source: Internet
Author: User
Tags hmac ssh server

1. The applicable order and scheme are as follows:
"Remote Connect and Execute command"
SSH-P22 [email protected]
SSH-P22 [email protected] /sbin/ifconfig
"Remote copy: Push and Pull"
Scp-p22-r-p/etc [email protected]:/tmp/
Scp-p22-r-P [email protected]:/tmp//etc
"Secure FTP Feature"
sftp-oport=22 [email protected]
"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. On the SSH server, change the configuration in the/etc/ssh/sshd_config file to the following:
Usedns no
# GSSAPI options
Gssapiauthentication no
Then, Performing/etc/init.d/sshd Restart Restart the sshd process so that the above configuration takes effect, the connection is generally not slow.

2, if it is slow, check the SSH server on the/etc/hosts file, 127.0.0.1 the corresponding hostname is the same as
Uname-n results, or the native IP and hostname (uname-n result) into/etc/ In the hosts.

12345678 [root @C64  ~] # Uname-n c64 [root @C64  ~] # cat/etc/hosts #modi by Oldboy 11:12 2013/9/24 127.0.0.1   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 function to find the cause of slow
In fact, you can use the following command to debug why the slow details (learning this idea is very important).

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 6667686970717273747576777879808182 [root@C64~]# ssh -v [email protected]OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010debug1: Reading configuration data /etc/ssh/ssh_configdebug1: Applying options for*debug1: Connecting to 10.0.0.19 [10.0.0.19] port 22.debug1: Connection established.debug1: permanently_set_uid: 0/0debug1: identity file /root/.ssh/identity type -1debug1: identity file /root/.ssh/id_rsa type -1debug1: identity file /root/.ssh/id_dsa type -1debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3debug1: match: OpenSSH_4.3 pat OpenSSH_4*debug1: Enabling compatibility mode forprotocol 2.0debug1: Local version string SSH-2.0-OpenSSH_5.3debug1: SSH2_MSG_KEXINIT sentdebug1: SSH2_MSG_KEXINIT receiveddebug1: kex: server->client aes128-ctr hmac-md5 nonedebug1: kex: client->server aes128-ctr hmac-md5 nonedebug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sentdebug1: expecting SSH2_MSG_KEX_DH_GEX_GROUPdebug1: SSH2_MSG_KEX_DH_GEX_INIT sentdebug1: expecting SSH2_MSG_KEX_DH_GEX_REPLYThe 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=======>老男孩老师评:这里就是提示保存密钥的交互提示。Warning: Permanently added ‘10.0.0.19‘ (RSA) to the list of known hosts.debug1: ssh_rsa_verify: signature correctdebug1: SSH2_MSG_NEWKEYS sentdebug1: expecting SSH2_MSG_NEWKEYSdebug1: SSH2_MSG_NEWKEYS receiveddebug1: SSH2_MSG_SERVICE_REQUEST sentdebug1: SSH2_MSG_SERVICE_ACCEPT receiveddebug1: Authentications that can continue: publickey,passworddebug1: Next authentication method: publickeydebug1: Trying private key: /root/.ssh/identitydebug1: Trying private key: /root/.ssh/id_rsadebug1: Trying private key: /root/.ssh/id_dsadebug1: Next authentication method: password[email protected]‘s 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-8Last login: Tue Sep 24 10:30:02 2013 from 10.0.0.18在远程连接时如果慢就可以确定卡在哪了。[root@C64_A~]# ssh -v [email protected]OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010debug1: Reading configuration data /etc/ssh/ssh_configdebug1: Applying options for*debug1: Connecting to 10.0.0.17 [10.0.0.17] port 22.debug1: Connection established.debug1: permanently_set_uid: 0/0debug1: identity file /root/.ssh/identity type -1debug1: identity file /root/.ssh/id_rsa type -1debug1: identity file /root/.ssh/id_dsa type 2debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3debug1: match: OpenSSH_5.3 pat OpenSSH*debug1: Enabling compatibility mode forprotocol 2.0debug1: Local version string SSH-2.0-OpenSSH_5.3debug1: SSH2_MSG_KEXINIT sentdebug1: SSH2_MSG_KEXINIT receiveddebug1: kex: server->client aes128-ctr hmac-md5 nonedebug1: kex: client->server aes128-ctr hmac-md5 nonedebug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sentdebug1: expecting SSH2_MSG_KEX_DH_GEX_GROUPdebug1: SSH2_MSG_KEX_DH_GEX_INIT sentdebug1: expecting SSH2_MSG_KEX_DH_GEX_REPLYdebug1: Host ‘10.0.0.17‘is known and matches the RSA host key.debug1: Found key in/root/.ssh/known_hosts:2debug1: ssh_rsa_verify: signature correctdebug1: SSH2_MSG_NEWKEYS sentdebug1: expecting SSH2_MSG_NEWKEYSdebug1: SSH2_MSG_NEWKEYS receiveddebug1: SSH2_MSG_SERVICE_REQUEST sentdebug1: SSH2_MSG_SERVICE_ACCEPT receiveddebug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,passworddebug1: Next authentication method: gssapi-keyexdebug1: No valid Key exchange contextdebug1: Next authentication method: gssapi-with-mic

The above configuration does not match the discovery card to gssapi this. You probably know it's a gssapi problem.
In fact, the Linux System Optimization section should optimize the SSH service here.

Linux under SSH remote Connection service Slow solution

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.