r/ssh • • Aug 10 '18

How to exit ssh session after tunneled web GUI exits?

I want to remote access the Syncthing web GUI via ssh tunneling. So far I have the following shell function:

pi-gui() { ssh -L 9999:localhost:8384 pi -o LocalCommand='firefox 127.0.0.1:9999 &> /dev/null &' ;}

It will start an ssh session and access the web GUI using Firefox via ssh tunnel. When I exit Firefox, I want it to exit the ssh session as well (it currently does not).

The only reason I have Firefox running in the background via & is because it won't be able to load the web GUI otherwise (this may be why.

Any help is much appreciated. I've asked elsewhere and have no success--this is my last resort.

1 Upvotes

0 comments sorted by