Push’ files from one linux machine to another via SSH

Posted on

Problem :

I have 2 linux machines, one (1st) containing about 8 GB of small files (images, flv etc)

I need to upload/push those files to the other machine (2nd).

I would use rsync to pull them down to the 2nd machine however the 1st machine (containing the files) has file wall rules that I cannot circumvent therefore I cannot ssh into it from the 2nd machine.

Solution :

rsync can operate in either direction; either pulling files or pushing them. Since you can’t pull from machine 1, why not push from machine 1 to machine 2? The syntax for rsync is just like scp.

rsync options source destination

So, in your case, you might…

rsync -azv ~/my_folder chris@machine2.local:~

This will copy ~/my_folder/ to the same location on machine 2.

You could use scp with the -r flag here as well, but rsync is more suited for the task.

Leave a Reply

Your email address will not be published. Required fields are marked *