Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a SOCKS5 tunnel, but for some reason using -D does not work. Here is an excerpt:

laptop:~ localuser$ ssh -D 8080 -p 2222's password: 
Last login: Mon Apr 22 08:49:37 2013 from [~]# 

It creates an interactive session rather than opening a port. Why?

share|improve this question
up vote 4 down vote accepted

This is the correct behavior. SSH establishes a tunnel and opens an interactive session. If you want the tunnel only, use the -N option of ssh; you might also be interested in combining that with -f:

ssh -Nf -D 8080 -p 2222

From man ssh

-f Requests ssh to go to background just before command execution. This is useful if ssh is going to ask for passwords or passphrases, but the user wants it in the background. (...)

-N Do not execute a remote command. This is useful for just forwarding ports (protocol version 2 only).

share|improve this answer

You are missing -N

And if you don't want a running session and just the tunnel use -f

ssh -f -D 8080 -p 2222 -N

share|improve this answer

You must log in to answer this question.

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