我通常使用以下方法通过防火墙连接到远程机器:
ssh -xv [email protected]
进而:
ssh -xv [email protected]
请注意这remote
实际上是一个 IP 地址。 我见过这问题并尝试将我的~/.ssh/config
文件写为:
Host ras
Hostname ras.cse.ust.hk
User farshidhss
Host farshid
ProxyCommand ssh -q ras nc -q0 10.89.100.72 22
然后尝试ssh -xv luca@farshid
,但它卡在最后一行:
luca@jarvis:~$ ssh -xv luca@farshid
OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /home/luca/.ssh/config
debug1: /home/luca/.ssh/config line 5: Applying options for farshid
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Executing proxy command: exec ssh -q ras nc -q0 10.89.100.72 22
debug1: permanently_drop_suid: 1000
debug1: identity file /home/luca/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/luca/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/luca/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/luca/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/luca/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/luca/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/luca/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/luca/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
我检查了端口是否正确并且也尝试了ProxyCommand ssh -W 10.89.100.72:22 farshid
但没有成功并且 netcat 已安装ras.cse.ust.hk
(which nc
返回/bin/nc
)。
更新了〜/ ssh / config:
Host ras
Hostname ras.cse.ust.hk
User farshidhss
Host farshid
User luca
ProxyCommand ssh -o 'ForwardAgent yes' [email protected] 'ssh-add && nc %h %p'
尝试连接,ssh -xv farshid
但输出与之前相同,并卡在那里