I have ~/.ssh/config
file on my local machine as:
Host head
User Marry
HostName xxx.xx.xxx.xx
Host machine1
User Marry
HostName xxx.xxx.xxx.xx
IdentityFile /home/Marry/ssh_head_keys/id_rsa
ProxyCommand ssh head nc %h %p 2> /dev/null
Host machine2
User Marry
HostName xxx.xxx.xxx.xx
IdentityFile /home/Marry/ssh_head_keys/id_rsa
ProxyCommand ssh head nc %h %p 2> /dev/null
Host machine3
User Marry
HostName xxx.xxx.xxx.xx
IdentityFile /home/Marry/ssh_head_keys/id_rsa
ProxyCommand ssh head nc %h %p 2> /dev/null
Host machine4
User Marry
HostName xxx.xxx.xxx.xx
IdentityFile /home/Marry/ssh_head_keys/id_rsa
ProxyCommand ssh head nc %h %p 2> /dev/null
I can successfully do ssh machine1
, ssh machine2
, ssh machine3
my local machine, and go to machine 1-3, but for machine4, the command ssh machine4
failed with:
ssh_exchange_identification: Connection closed by remote host
How could this happen?
UPDATE: follow muru's advice, remove 2> /dev/null
, I got the message when ssh to machine4:
bash: nc: command not found
ssh_exchange_identification: Connection closed by remote host
0 Answers