Search code examples
unixsshssh-keysssh-tunnel

How to create ssh tunnel and keep in running


I want to access machine A which is behind the firewall through a jump host from machine B.

I want to do the same either via ssh keys or via username and password.

What will be the steps and the commands to achieve the same?


Solution

  • The feature is called port forwarding:

     ssh -L localport:machine-a-address.domain:remote-port machine-b
    

    Then you can simply use localpott on localhost to access the remote service on machine-a, for example:

    telnet localhost localport