ssh登陆慢问题

ssh -v
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
debug1:Unspecified GSS failure.Minor code may provide more information
Cannot determine realm for numeric host address
debug1:Unspecified GSS failure.Minor code may provide more information
Cannot determine realm for numeric host address
debug1:Unspecified GSS failure.Minor code may provide more information
debug1:Unspecified GSS failure.Minor code may provide more information
Cannot determine realm for numeric host address
debug1:Next authentication method: publickey
debug1:Tryingprivate key:/home/mitchellchu/.ssh/id_rsa
debug1:Tryingprivate key:/home/mitchellchu/.ssh/id_dsa
debug1:Tryingprivate key:/home/mitchellchu/.ssh/id_ecdsa
debug1:Next authentication method: password

可以看出连接顺序GSSAPI,Public_key,password
password方式登陆的话,前面耗费时间过长
解决办法:
禁用GSSAPI,使用Public_key方式登录,弃用password方式

禁用GSSAPI认证有两个方式:客户端和服务端
客户端:
ssh -o GSSAPIAuthentication=no your-server-username@serverIP
手动输入麻烦的话,可以使用Xshell的快速命令功能
服务端:
/etc/ssh/sshd_config
GSSAPIAuthentication no

 

若卡在SSH2_MSG_SERVICE_ACCEPT received很久,则修改为UseDNS no

发表评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注