Ssh port forwarding without logging in

port-forwardingssh

I am forwarding a port of a remote server to my local mac as follows:

ssh -L 15672:localhost:15672 me@example.com

When I do this in a shell, I am also logged into example.com. Yet I would like the command to return and not occupy my shell.

Is there an option to do this?

Best Answer

You should add -N to avoid getting a shell on the remote, and -f to move the process to the background without losing it if you close the shell.

Related Question