ssh -L 3000:localhost:3000 -N remotehost
-N
- for "run no command". To create a local port forwarding, pass the -L
option to the ssh client
ssh -L 3000:localhost:3000 -N remotehost &
&
- for send that SSH process to the background
$ ssh -N -L 27017:127.0.0.1:27017 remotehost &
kill $!
or
kill %1