I have to set up a tunnel between two hosts.
For this I use ssh
in this way:
ssh -L MY_LOCAL_PORT:FOREIGN_ADDRESS:FOREIGN_PORT MYUSER@SSH_SERVER
after that, I log in to my SSH_SERVER.
How can I avoid this feature?!
I have only to set up a tunnel. I don't have to login into my SSH_SERVER…
I've tried the -N option, but it kept my shell busy.
Best Answer
As said in other posts, if you don't want a prompt on the remote host, you must use the
-N
option of SSH. But this just keeps SSH running without having a prompt, and the shell busy.You just need to put the SSH'ing as a background task with the
&
sign :This will launch the ssh tunnelling in the background. But some messages may appear, especially when you try to connect to a non-listening port (if you server apache is not launched). To avoid these messages to spawn in your shell while doing other stuff, you may redirect STDOUT/STDERR to the big void :
Have fun with SSH.