3

I need to transfer and then update a directory structure from a linux host in my network to another linux host in a customer network. My only access to the customer network is through a Citrix client. I can login through SSH and I can copy files over SCP but I can't do any sort of port-forwarding between the two networks.

Obviously I have to copy over the entire directory structure as a tarball the first time. But after that, is there any way to optimize the creation of the tarball based on a listing of the remote directory structure?

Can anybody recommend a unix command-line tool to help with the above?

Russ Weeks
  • 133
  • 2
  • "I can't do any sort of port-forwarding between the two networks." Hint, outbound SSH from the client network means yes you can. – dmourati Sep 03 '13 at 20:35
  • I don't have outbound SSH from the client network to any internet host or to any host in my home network. – Russ Weeks Sep 03 '13 at 22:39
  • I'll add this as an answer as soon as I'm able: I think the best option is for me to keep an expanded copy of the filesystem tarball locally and for subsequent updates use the --write-batch-file option of rsync to capture the changes between my working copy and the snapshot of the remote filesystem. Then I transfer the batch file to the target system and apply the changes with rsync using --read-batch-file. In hindsight my question was worded a little obscurely, sorry about that. – Russ Weeks Sep 03 '13 at 22:43

3 Answers3

2

You can use incremental tar archives with gnu tar (but not bsd tar) over ssh to transfer just the changes. The first tar will be level 0, then level 1...You'll need to keep the snapshot.snar file and reference it each time or else it will create a new level 0.

$ tar --listed-incremental snapshot.snar -cf - dir | ssh user@host "tar --listed-incremental=/dev/null -xf -"

if you would like to use compression to speed the transfer, you might add a 'z' or a 'j' switch to both tar commands.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
1

You can use rsync+ssh to do it (using the rsync "-e" option).

Example: rsync -avu -e 'ssh' /local/dir/appA user@host:remote_dir/

Matheus
  • 2,779
  • 1
  • 11
  • 4
1

You can just rsync -av /local/dir/appA user@host:remote_dir/ — but rsync program has to be installed on the server end.

If there's no rsync installed there then you can use:

mkdir /tmp/host
sshfs user@host:remote_dir/ /tmp/host/

and then:

rsync -av /local/dir/appA/ /tmp/host/
Tometzky
  • 2,679
  • 4
  • 26
  • 32