Isso não foi testado (já que não uso GUIs), mas tente isto:
#!/bin/bash
# From this answer http://unix.stackexchange.com/a/29949/82289
[email protected]
ssh -f -N -D 12345 -M -S /tmp/ssh_tunnel_%h.sock -o ExitOnForwardFailure=yes $SSH_HOST && \
echo "ssh tunnel started successfully" || \
echo "ssh tunnel failed to start"
# Launch firefox
firefox -P uniprofile -no-remote
# We should only get here after firefox closes
# Close the ssh tunnel socket
ssh -S /tmp/ssh_tunnel_%h.sock -O exit $SSH_HOST
# End shell-script
As duas bandeiras -f
e -N
são o que eu acho que você quer ( do homem ssh ).
-f
Requests ssh to go to background just before command execution. This is useful if ssh is going to ask for passwords or passphrases, but the user wants it in the background. This implies -n. The recommended way to start X11 programs at a remote site is with something like ssh -f host xterm.
-N
Do not execute a remote command. This is useful for just forwarding ports (protocol version 2 only).