Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello All

I need to copy files from our non-routable host (172.x.x.x) to a series of hosts on the Internet. I have been reading about tunneling and thought it would be the cleanest option of:

1. rsync the data directories to a dmz and then use perl

2. use nfs between the file server and the dmz

Unfortunately, I don't see how to make the first ssh connection using -L before attempting the scp. Any suggestions appreciated.

Thanks

  • Comment on scp file from non-routable to routable hosts

Replies are listed 'Best First'.
Re: scp file from non-routable to routable hosts
by insaniac (Friar) on Mar 21, 2005 at 18:54 UTC
    hm.. not really perl related, but okay...
    a piece of the rsync man page:

    You can also specify any remote shell you like, either by using the -e command line option, or by setting the RSYNC_RSH environment variable.

    --
    to ask a question is a moment of shame
    to remain ignorant is a lifelong shame
Re: scp file from non-routable to routable hosts
by sh1tn (Priest) on Mar 21, 2005 at 21:07 UTC
    You may want to see Net::Rsh. Sample usage (with cmts ios):
    ... $o = Net::Rsh->new(); $host = "10.0.0.1"; $luser = "root"; $ruser = "rcmd"; $com1 = "scm c$cable up $up"; $com2 = "scm c$cable up $up phy"; $com3 = "scm c$cable up $up su"; ... @results = $o->rsh($host,$luser,$ruser,$com1); @snr = $o->rsh($host,$luser,$ruser,$com2); @sum = $o->rsh($host,$luser,$ruser,$com3); ...


Re: scp file from non-routable to routable hosts
by beauregard (Monk) on Mar 22, 2005 at 01:26 UTC
    Why in the world wouldn't you just use NAT/masquerading on the router (which is ideal for making non-routable/private hosts able to open connections to the outside) with scp or even ftp to actually send the file?

    ssh tunelling is great and all that, but it's more complicated and may slow things down. The only time I'd recommend it for simple file sending is when (a) you don't have control/intelligence at the router or (b) you're making a quicky VPN using PPP.

    c.

Re: scp file from non-routable to routable hosts
by scmason (Monk) on Mar 21, 2005 at 19:05 UTC
    To elaborate on the above:

    rsync -e ssh rest_of_command

    If you have you ssh keys set, you will not be required to enter a password.

    File::Rsync might be of some help too.

Re: scp file from non-routable to routable hosts
by perlfan (Parson) on Mar 21, 2005 at 21:30 UTC
Re: scp file from non-routable to routable hosts
by Anonymous Monk on Mar 22, 2005 at 02:33 UTC
    how about just this (assuming you have your ssh keys all set)
    tar cf - $directory | ssh $dmz "ssh $final_dest tar xf -"
    there's no need for scp if you're tunneling over ssh, why encrypt/decrypt more than than once... but if you must it might take some fooling with ssh/scp options...
    ssh -f -L 9999:$final_dest:22 $dmz sleep 30 scp -o StrictHostKeyChecking=no -P 9999 $directory localhost: