Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 use this command to create a reverse tunneling from my home machine to an AWS instance, so that I can connect to my home machine from anywhere

ssh -R 5000:localhost:8000 aws_machine

However, when I execute this command on my home machine, it prompts for my password and logs into my AWS instance.

Edit: Got it to work using few extra parameters

ssh -g -f -R 5000:localhost:8000 aws_machine -N
share|improve this question
That's as expected. To create a tunnel, you have to have a connection from your machine to the remote machine . . . you may want to check the man page for ssh, as you'll likely the the -g option, and you may want to use the -f option. – ernie Aug 26 '13 at 17:29
@ernie. Thanks. To have a connection we can use -g – ganessh Aug 26 '13 at 17:44

That behavior sounds like expected behavior. To create a tunnel, you have to have a connection from your machine to the remote machine. It sounds as if you want to create the tunnel, but not have a foreground SSH session.

I'd suggesting checking the man page for ssh, and you'll probably want to use

  • -g this will allow for remote hosts to use the tunnel
  • -f this backgrounds the SSH session after login (you'll need to search for the ssh command and kill it afterwards if you want to close the tunnel)
  • -N you'll need to this to background the session, as -f expects a command
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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