Temporary solution: For now I am using a systemd service to handle this, using invoke to respond to the password.
I am having trouble executing the following command over SSH:
ssh -t user@host "sshuttle -D --dns -r user@host:port -x 192.168.1.0/24 0/0"
working (no daemon):
ssh -user1@host1 ssh user2@host2 'sudo sshuttle --dns -r user3@host3:port -x 192.168.1.0/24 0/0'
Doesn't work (with daemon and sleep):
ssh -user1@host1 ssh user2@host2 'sudo sshuttle -D --dns -r user3@host3:port -x 192.168.1.0/24 0/0 && curl ifconfig.co && sleep 3'
I have determined that the issue is entirely due to the -D (daemon) argument.
- This code works when run locally (on the remote server)
- The issue is not due to superuser privileges.
- I have tried many combinations (including manually invoking bash -c and bash -s.)
- I have deployed a bash script remotely and have executed the script over SSH to start the tunnel.
- I have tried dropping the -D arg and using nohup and & (together and separately).
- I have modified "/etc/systemd/logind.conf" to "KillUserProcesses=no"
All attempts result in the successful return/exit codes, yet, no tunnel is initiated. If I drop the daemon arg it works fine, but I need it alive in the background.
Any ideas on how I can execute the sshuttle daemonized over SSH?