SSH Tunneling with restricted/limited shell

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

Comments (0)

› No comments yet.

Leave a Reply

Allowed Tags - You may use these HTML tags and attributes in your comment.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Pingbacks (0)

› No pingbacks yet.