Search This Blog

Multiple Hop SSH access

I have a desktop computer, homepc, at home and I want to access my desktop computer, workpc, at work. However, workpc does not have an public ip, therefore, it is not directly accessible from home. I have go through the gateway computer, Gateway.mycompany.com, at work.
ssh -oproxycommand="ssh Gateway.mycompany.com nc %h %p" WorkPC

Note: WorkPC can the internal IP address or internal host name recognized by Gateway. The host name (or ip address) of the Gateway must be public accessible.
ssh -oproxycommand="ssh Gateway.mycompany.com nc %h %p" 192.168.20.12

Note: if nc is not installed on the Gateway, you can try the following command instead:
ssh -oproxycommand="ssh Gateway.mycompany.com /bin/bash -c 'exec 3<>/dev/tcp/%h/%p; cat <&3 & cat >&3;kill $!'" WorkPC

See also:

No comments:

Post a Comment