I'm trying to create a simple SSH tunnel using OpenSSH.

I have a VPS server listening on port 4444 for SSH.

From my local Ubuntu machine, I wish to create the SSH tunnel to http://edition.cnn.com/.

I use the following command:

ssh -L 5050:edition.cnn.com:80 x.x.x.x -p 4444

where x.x.x.x is my VPS IP.

I then press Enter, and wait a couple of seconds.

Instead of the tunnel being created, I'm logged in via SSH to my VPS.

What is wrong with my command syntax? Everywhere I look I find that I invoke it correctly.

  • By default ssh creates and connects to a remote shell or other specified command in addition to any tunnels enabled with -L/D/R and -X/Y. To not run the remote shell/command use -N. See the man page. – dave_thompson_085 Mar 26 '17 at 17:33

Your command has setup tunnel just fine. Try connecting to localhost:5050 and that should take you to remote host (this may not work for vhosts and you need local hosts entry). If you are looking to setup a generic HTTP proxy via your VPS server, take a look at this question and use SOCKS proxy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.