Ssh/scp is a common command. It is found that the speed of establishing a connection over ssh is very slow for some hosts, but the operation speed is normal after the connection is established.
Use ssh-v to view the detailed connection establishment process:
Debug1: Authentications that can continue: publickey, gssapi-with-mic, password
Debug1: Next authentication method: gssapi-with-mic
Debug1: Unspecified GSS failure. Minor code may provide more information
No credentials cache found
Debug1: Unspecified GSS failure. Minor code may provide more information
No credentials cache found
Debug1: Unspecified GSS failure. Minor code may provide more information
Debug1: Next authentication method: publickey
It turns out that it is a waste of time to try the gssapi-with-mic authentication method. Open/etc/ssh/ssh_config and change GSSAPIAuthentication yes to no to disable it.
If the above solution cannot be solved, we can proceed with troubleshooting.
The most common reason for solving this problem is that the server's sshd will go to DNS to find access.
The hostname of the client IP address. If 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. In addition, problems may also occur in authentication gssapi-with-mic, modify GSSAPIAuthentication no in the/etc/ssh/sshd_config file on the server.
3. Modify hosts in/etc/nsswitch. conf on the server to hosts: files
4. reboot server to make the configuration take effect
/Etc/init. d/sshd restart the sshd process to make the configuration take effect.
The project team's server remotely accesses the Linux server through the SSH service. It is always waiting for a long time to log on.
Try the following method, and then remotely access the Linux server through the SSH service, and instantly log on... Very happy...
Vi/etc/ssh/sshd_config
Disable ssh dns anti-resolution and add the following line:
UseDNS no
※Although [UseDNS yes] in the configuration file is commented out,
But the default switch is yes... (DNS reverse resolution is enabled by default in the SSH service)