Secure way to transfer files between servers

For most of the common Linux/Unix systems, they have good concepts of pipeline, which give us a chance to copy data easliy among different servers.

What you need to do is to establish a instant connection between your servers, and we offen create such connections by OpenSSH. If you’re running openssh, the connection is encryped. When established, tranferring files between servers are much like a local copy or move. What’s more, It’s much secure as you are using a encryped channel.

I’ll give you some quick examples, it would be helpful for your daily system administration. if you want to build a reuse SSH connection, please google around ;-) :

Copy large amount of small files quickly (without compress)
tar cf – * –exclude=logs/* | ssh -p PORT user@remote.admon.org “cd /node1/; tar xvf -”

Copy large amount of small files quickly (with compress)
tar zcf – * –exclude=logs/* | ssh -p PORT user@remote.admon.org “cd /node1/; tar zxvf -”

Dump Postgres Database using pg_dump
pg_dump -U USER DATABASE-NAME | ssh -p PORT user@remote.admon.org “dd of=/backup/pgsql-$(date +’%d-%m-%y’)”

Dump MySQL Database using mysqldump
mysqldump -u USER -p’PASSWORD’ DATABASE-NAME | ssh -p PORT user@remote.admon.org “dd of=/backup/mysql-$(date +’%d-%m-%y’)”

No related posts.

Tags: , ,


Joseph chen is a system administrator from south China. He has a keen interest in Open Source and system administration solutions.

One Response to “Secure way to transfer files between servers”

  1. Petula says:

    Hi everyone. Looks good. Very useful, good stuff. Good resources here. Thanks much. Help me!

Leave a Reply

© 2006-2009 Admon Home. All rights reserved.