Manage your ssh tunnels!

Yet another kind of controlling background ssh process. Actually it can be modified to controlling any process without pid saving feature.

So, here we go: $ git clone $ cp bgctl/bgctl $ chmod +x
This trick based on environment inheritance of processes in linux, so we can declare any unique named variable to ssh process and later find it name in /proc/.

The next line appended to the end of bgctl -p /tmp/ -- ssh -f -N -R username@
After run ./ and successful ssh authorization in /tmp folder will be created file with correct pid of forked ssh process.

In finally, to stop ssh tunnel run: $ ./ stop

All done, have a nice day.

Leave a Reply

Your email address will not be published. Required fields are marked *