9
2
I am trying to forward my port 8085 which is a live camera stream port for a mini http server, to a remote server.
My command which I am using is as so:
ssh -R $rport:dc-bb7925e7:$camport -p 25 server@192.168.178.20
As this command is right now, it does forward the port and I can see the live stream on the remote server by going to localhost:8085, BUT the problem is that on the client, there is a TTY session open which prevents all further scripts from running.
So I tried using ssh in the background with:
ssh -Nf -R $rport:dc-bb7925e7:$camport -p 25 server@192.168.178.20
This does not work as it seems as if the connection is closed. The port forwarding is being used in a script where the script assesses an if/then/else condition and then executes to forward. Forwarding this port is not suposed to halt all other scripts. It should simply forward the port and then move on, while keeping it open.
What am I doing wrong or are there any other flags that can be used?
The flags you are using should work. The -N makes the ssh non-interactive by not running any command on the remote host and the -f causes the ssh command to run in the background which should allow your script to continue running. I have tested on my local machine and they work as expected. Are you sure there is no other error when running hte script? – Aner – 2014-10-17T21:55:25.557