summaryrefslogtreecommitdiff
path: root/localautossh
blob: 92aa7a4820c31e46c45e276967f8b2d4b9086f63 (plain)
  1. #!/bin/sh
  2. #
  3. # Example script to start up tunnel with autossh.
  4. #
  5. # This script will tunnel 2200 from the remote host
  6. # to 22 on the local host. On remote host do:
  7. # ssh -p 2200 localhost
  8. #
  9. # $Id: localautossh,v 1.1 2007-08-07 16:34:50 jonas Exp $
  10. #
  11. if [ -z "$SSH_ASKPASS" ]; then
  12. export SSH_ASKPASS="ssh-askpass"
  13. fi
  14. if [ "X$SSH_AUTH_SOCK" = "X" ]; then
  15. eval `ssh-agent -s`
  16. ssh-add $HOME/.ssh/id_rsa
  17. fi
  18. #AUTOSSH_POLL=600
  19. #AUTOSSH_PORT=20000
  20. #AUTOSSH_GATETIME=30
  21. #AUTOSSH_LOGFILE=$HOST.log
  22. #AUTOSSH_DEBUG=yes
  23. #AUTOSSH_PATH=/usr/local/bin/ssh
  24. export AUTOSSH_POLL AUTOSSH_LOGFILE AUTOSSH_DEBUG AUTOSSH_PATH AUTOSSH_GATETIME AUTOSSH_PORT
  25. autossh -2 -fN -M 20000 -R 2200:localhost:22 "$1"