3

I'm trying to open an ssh connection to let one server access a remote postgres database. So I followed the instructions in this postgres help page.

When I run the command:

ssh -L 3333:foo.com:5432 [email protected]

It connects me automatically to the remote server the same way it would with a regular ssh. At that point my connection works fine. The problem I'm facing is when I close the terminal, the connection is lost so I looked on how to run that same command in the background but with no luck. This is what I tried but it doesn't actually work:

nohup ssh -L 3333:foo.com:5432 [email protected] &

How can I run the ssh -L tunneling command in the background?

Thanks in advance.

1

1 Answer 1

6

After trying few options of ssh, I actually found the solution. Here it is:

ssh -f -N -L 3333:foo.com:5432 [email protected]
Sign up to request clarification or add additional context in comments.

1 Comment

-f Requests ssh to go to background just before command execution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.