我在使用 Putty(以及 Linux 终端)登录本地网络 linux(服务器)ssh 时遇到问题
当我的服务器显示插入用户名的请求时,我插入“root”,然后按 Enter 键。
在它请求我的密码之前,我等待了大约七秒钟!
并尝试接受答案,也使用命令
/etc/init.d/ssh restart
它不起作用。我的朋友告诉我,我应该使用另一个 SSH 守护进程,但我不知道是哪个。我现在能做什么?
我当前的 /etc/ssh/ssh_config 配置:
# configuration file, and defaults at the end.
# Site-wide defaults for some commonly used options. For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.
Host *
# ForwardAgent no
# ForwardX11 no
# ForwardX11Trusted yes
# RhostsRSAAuthentication no
# RSAAuthentication yes
# PasswordAuthentication yes
# HostbasedAuthentication no
GSSAPIAuthentication no
GSSAPIDelegateCredentials no
GSSAPIKeyExchange no
# GSSAPITrustDNS no
# BatchMode no
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/identity
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# Port 22
# Protocol 2,1
# Cipher 3des
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,[email protected],hmac-ripemd160
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com
SendEnv LANG LC_*
HashKnownHosts yes
答案1
您不需要另一个 SSH 守护进程。您可能需要明确地禁用(而不是简单地注释掉)GSSAPIAuthentication
并GSSAPIKeyExchange
在客户端中;另一个问题没有提到后者,可能是因为它是最近添加的,我认为它仍然是供应商应用的第三方补丁。 (至少 Debian Squeeze 肯定有它。) GSSAPIDelegateCredentials
不需要碰它,因为它只在GSSAPIAuthentication
启用时查看。
如果上述方法没有做到这一点,您的下一步就是strace
查看它在暂停期间正在做什么。
strace /usr/bin/ssh -vvv host
这假设它是客户端;服务器有点难调试。如果涉及到这一点,您将需要禁用普通服务器(在现代世界中是这样service ssh stop
),然后执行类似的操作
sudo strace -f /usr/sbin/sshd -ddd
之后不要忘记重新激活正常服务器service ssh start
!
答案2
可能是 DNS 问题,如果是这样,请尝试取消注释:
# GSSAPITrustDNS no
使它成为
GSSAPITrustDNS no
目前它可以解决这些问题,但真正的解决办法是解决 DNS 问题。附带说明一下,在 SSH 命令中添加 -vvv 将打印出更多信息,让您更好地了解在哪里查看,例如:
ssh -vvv <user>@<server>