|
Under Linux SSH remote connection service slow Solutions
1, for command and program are as follows:
[Remote connection and Run]
ssh -p22 root@192.168.1.253
ssh -p22 root@192.168.1.253 / sbin / ifconfig
[Remote Copy: Push and pull]
scp -P22 -r -p / etc root@192.168.1.253: / tmp /
scp -P22 -r -p root@192.168.1.253: / tmp / / etc
[Secure FTP function]
sftp -oPort = 22 root@192.168.1.253
[] No password authentication scheme
For example, using sshkey bulk distribution of documents, perform deployment operations.
2, the main reason for the connection is slow DNS resolution result
Solution:
The most common reason is because the server's sshd will go to visit client IP DNS lookup of hostname, if DNS is not available or no relevant records, will spend a lot of time.
1, in the server / etc / hosts file to your local machine's IP and hostname added
2, change the / etc / ssh / sshd_config file to configure the following on the ssh server:
UseDNS no
# GSSAPI options
GSSAPIAuthentication no
GSSAPIAuthentication parameter for Kerberos authentication, and for most people, it is impossible to use this authentication mechanism, so pay attention to them stopped.
Then, perform /etc/init.d/sshd restart restart sshd configuration to take effect the above-mentioned process, the connection is not generally slow.
3, if it is slow, checking on ssh server / etc / hosts file, 127.0.0.1 and the corresponding host name
uname -n The same results, or to the local ip and hostname (uname -n result) was added to the / etc / hosts Lane.
3, using ssh-v debugging function to find the reasons for slow
In fact, you can use the following command to debug a slow Why the details (learn this idea is very important).
[Root @ localhost ~] # ssh -v root@192.168.2.15
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 192.168.2.15 [192.168.2.15] 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 '192.168.2.15 (192.168.2.15)' can not 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
=======> This is prompted to save the key interactive prompt.
Warning: Permanently added '192.168.2.15' (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@192.168.2.15's password:
=======> This is prompted interactively prompted for 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 192.168.2.13
When a slow remote connection if you can determine where the cards.
[Root @ localhost ~] # ssh -v oldboy@192.168.2.18
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 192.168.2.18 [192.168.2.18] 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 '192.168.2.18' 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
With the above arrangement is not found to gssapi this card. They probably know gssapi problem. In fact, part of the Linux system optimization should be optimized SSH service here. |
|
|
|