王高利:Linux__ssh連接緩慢,解決方法如下

ssh -v 192.168.1.138

然後會出現很多bug

例如:

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

查看一下連接時間:

time  ssh [email protected] exit
real0m4.785s
user0m0.014s
sys0m0.011s


1、關閉DNS反向解析

在linux中sshd 的服務裏是默認開啓DNS解析的。會消耗時間,所以需要關閉。

vim /etc/ssh/sshd_config
UseDNS no

雖然是被註釋掉的,但是默認是yes開啓的。

time ssh [email protected] exit
real0m3.978s
user0m0.016s
sys0m0.010s


看實際的連接時間明顯減少了很多。說明起了作用!


2、關閉SERVER的認證

在authority過程中,gssapi-with-mic有可能出現很大問題,因此關閉gssapi可以提高很大的速度。

vim /etc/ssh/sshd_config
GSSAPIAuthentication no

保存推出

time ssh [email protected] exit
real 0m3.832s
user 0m0.011s
sys  0m0.004s

時間明顯減少了很多。基本上就可以正常使用了。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章