Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have server 1 and Server 2.

In step one there is one script running in server1 that generates one file, after the process of creating the file is finish I need to upload the file to Server 2.

What is the best method and approach?

Thanks, Pedro

share|improve this question
up vote 2 down vote accepted

There are multiple ways to transfer files in linux. The most common and simples way is scp:

scp [[username@]host:]file-to-copy [[username@]host:]target

[]- marks optional arguments. If you for example is login in to server 1 you could do:

scp file-to-copy server2:/location/to/put/the/file/in

or if you need a different username on server2, change server2 to username@server2

If you which to have some more advanced features, like syncing and only copying new files, take a look at rsync (checkout man rsync)

share|improve this answer
Assumes sshd (package openssh-server) running on the target machine. – ysth Aug 3 '09 at 9:01
Ah, yes. Thank you, forgot that it is not installed per default in ubuntu. – Torandi Aug 3 '09 at 9:26
Don't forget keypairs without passwords allow you to copy without prompts etc. Making it easy to script. – Haakon Aug 3 '09 at 11:42

rsync is a good way of doing this

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.