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 a few php files on my server that I created and I'd like to download them to this computer for backup purposes. Is there an easy way to do this? (I'm connected to my server via SSH).

Also, are there any programs out there that can periodically source control or back up my webroot directory on my server automatically?

share|improve this question
up vote 5 down vote accepted

You can cron an rsync job to periodically sync it.

You can use the SSH FUSE module to mount the remote directory as a directory on your system and cron a copy or rsync to do it.

You can cron an SFTP or SCP script to periodically copy it over.

Those are a few things that come to mind off the top of my head that would work for limited purposes of a small backup.

I'd consider having a cron job on the server that tars and compresses the files you want to a special subdirectory, appending a date to the filename, and then syncing that to your local system just to keep track of some "snapshots" of the files in question.

share|improve this answer
Just what I wanted, thank you! – Vadoff Jul 27 '11 at 12:24
+1 for automating the process – Jim Blizard Jul 27 '11 at 12:36
Glad I could help, @Vadoff. – Bart Silverstrim Jul 27 '11 at 12:59

scp is the way to go in that case.

Here are some examples on how to use scp.

here is an example to download a file called myphp.php located in the /tmp folder and save it locally to your /tmp folder

scp your_username@your_server:/tmp/myphp.php /tmp

If you are using a windows machine locally you can use winSCP...

share|improve this answer

You can also have a look at Unison:

With Unison it is easy to have two replicas of files (it's not unidirectional, meaning that changes in A will propagate to B and changes in B will be propagated to A) and can be executed unattended. Another nice thing is that it'll only send the files that have changed, which is important if you have to transmit a lot of files or MB.

share|improve this answer

Use scp to downlaod files via ssh.

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.