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,, at work.
ssh -oproxycommand="ssh 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 nc %h %p"

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

See also:

No comments:

Post a Comment