4

I have an AWS cloud server that runs linux, to which i connect from my home computer. So far I used to use Putty to connect to it (Windows) but I just switched to Linux for my home computer.

I am trying to figure out how to create a tunnel while using a private key to connect through ssh.

The example on the different doc website is pretty straightforward:

To connect to the remote server:

ssh -i <key_file> [email protected]

This does work.

However to create a tunnel the doc mentions

ssh -L8080(portnumber):[email protected]:8080(remoteport)

But there isn't any mention of how to create a tunnel using a private key as in the first example.

I tried ssh -i <key_file> -L8080(portnumber):[email protected]:8080(remoteport)

but it didn't work.

Can anyone provide the correct command to create the tunnel while using a private key? Thanks!

1 Answer 1

17

You're conflating the port forwarding with the host (to connect to).

Formula is simply:

ssh user@host -i keyfile.pem -L 1234:127.0.0.1:2345
1
  • 5
    "conflating" = combine (two or more texts, ideas, etc.) into one. (sorry, not native english) May 8, 2019 at 8:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .