How to back up your web server via the terminal

This will backup your entire remote server to your local Macintosh computer.

rsync –recursive –verbose –archive –progress –stats –size-only –dry-run ~/Sites/

TO do for real repeat the command with –dry-run removed!

Here’s how to make it so you don’t need to type in your password each time you rsync to the remote machine:

1. Open the terminal window and type ssh-keygen -t rsa
Follow the prompts and use the defaults for the filenames it gives you. Don’t enter in a password.
2. Go to the finder menu Go|Go to Folder and type in ~/.ssh
You should then have two new files id_rsa and
3. Use your ftp program to copy into the .ssh directory in the home folder on your server machine, and rename it to authorized_keys.

If server IP address changed you need to delete entry from known_hosts file on local mac with this terminal ommand:

ssh-keygen -R hostname


Leave a Reply