If you want to connect to rsync/mysql or other service via localhost through SSH tunneling, you need the tunnel to stay open. There are rssh and other limited shells. But you can write your own. In this case, it opens for 10 seconds then closes. It does not close if there are activities (rsync takes longer than 10s) from my experience. It does nothing so there is no security to worry about.
1) Create sleepshell.c
main() {sleep (10);}
2) gcc sleepshell.c -o /usr/local/bin/sleepshell
3) useradd -m -d /home/tunneluser -s /usr/local/bin/sleepshell tunneluser
or usermod -s /usr/local/bin/sleepshell tunneluser
And that is it.
ssh -f -L 873:localhost:873 tunneluser@server “ANYTHING”
rsync –delete –delete-excluded –progress -zrltvp module@localhost dest
Leave a Reply