0

this is what i want to do :

#!/bin/bash

# start the tunnel
ssh tunnel@hostA -L 6000:hostB:22 -N
# this is the problem, i need to go next process after tunnel on

# Main proses that i must run under tunnel command
sftp -oPort=6000 user@localhost:/home/you <<GETME
lcd /home/me/temp
get *.tar
bye
GETME
echo " Job Done"

# i hope it can be add
# kill the tunnel after sftp done

right now i use 2 putty to run sftp to hostB, i think maybe it can be done in 1 single script

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
  • There should be a way to have `sftp` set up the tunnel for you; something like `sftp -o ProxyCommand="ssh tunnel@hostA ssh %h:%p" user@localhost:/home/you`. – chepner Aug 20 '15 at 03:12
  • See `man ssh_config`. They are the host name and port number that you connect to with `sftp`. Instead of connecting directly, you connect using the `ProxyCommand`. – chepner Aug 20 '15 at 11:26

0 Answers0