
我曾經使用 OpenSSH 使用以下命令連接到我的伺服器:
ssh [email protected]
但現在我已經更改了位置,並且無法再連接,這是我-v
在ssh
命令中使用參數時的調試報告:
ssh [email protected] -v
OpenSSH_6.0p1 Debian-3ubuntu1, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /home/riless/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to my-server.com [xx.xxx.xxx.xx] port 22.
debug1: Connection established.
debug1: identity file /home/riless/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/riless/.ssh/id_rsa-cert type -1
debug1: identity file /home/riless/.ssh/id_dsa type -1
debug1: identity file /home/riless/.ssh/id_dsa-cert type -1
debug1: identity file /home/riless/.ssh/id_ecdsa type -1
debug1: identity file /home/riless/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.0p1 Debian-3ubuntu1
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
一段時間後,它向我輸出:
Connection closed by xx.xxx.xxx.xx
注意:PuTTY 可以正常工作,但 OpenSSH 不能;我在Ubuntu上
EDIT1:文件內容/etc/ssh/ssh_config
(沒有註解行):
Host *
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes
GSSAPIDelegateCredentials no
文件內容/home/riless/.ssh/config
:
Host xx.xxx.xxx.xx
User root
Port 22
Hostname xx.xxx.xxx.xx
IdentityFile ~/.ssh/id_rsa
TCPKeepAlive yes
IdentitiesOnly yes
EDIT2:當我嘗試使用此命令列更改密碼時:
ssh [email protected] -c aes256-ctr -v
它提示我輸入密碼,但控制台隨即凍結:
[email protected]'s password:
debug1: Authentication succeeded (password).
Authenticated to xx.xx.xx.xxx ([xx.xx.xx.xxx]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LC_PAPER = fr_FR.UTF-8
debug1: Sending env LC_ADDRESS = fr_FR.UTF-8
debug1: Sending env LC_MONETARY = fr_FR.UTF-8
debug1: Sending env LC_NUMERIC = fr_FR.UTF-8
debug1: Sending env LC_TELEPHONE = fr_FR.UTF-8
debug1: Sending env LC_IDENTIFICATION = fr_FR.UTF-8
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending env LC_MEASUREMENT = fr_FR.UTF-8
debug1: Sending env LC_TIME = fr_FR.UTF-8
debug1: Sending env LC_NAME = fr_FR.UTF-8
答案1
您很可能在 /root/.ssh/authorized_keys 檔案中對 root 使用者的來源連線進行了限制。
具體來說,你的authorized_keys
可能看起來像這樣:
from="trusted.host.some.domain.ext,10.0.0.*,:*.untrusted.network.ext" ssh-rsa [your key] root@localhost
如果您的連線不符合「來自」模式(如果已明確從該模式中排除),則連線將被拒絕。
答案2
/etc/ssh/ssh_config
我剛剛在引用許多論壇時添加了一行。
Ciphers arcfour
現在我可以連接到伺服器了但仍存在一些問題:當我運行一些命令時,控制台凍結,例如vim
,htop
更新: 我已經找到了解決方案,但不知道它是如何工作的。
只需設定最大傳輸單元在你的乙太網路或無線介面上連接到一些非常小的東西。
sudo ifconfig wlan0 mtu 1100 # (or eth0 for ethernet)