Craig Stanfield
Craig Stanfield

Reputation: 21

ssh use rsync and backup to local

I have a website on a remote server and wish to get a backup copy locally in an automated process. This all owrked great until we moved some sites to a new provider (fasthosts) who have an extremely restrictive ssh interface where zip and tar are either disabled or not installed (nor can be) so we decided to go down the route of incremental backup. We got it working with no issues by copying the htdocs to a backup folder with this command (Note we access the server with ssh)

rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress /home/something/foo/bar/user/htdocs/  /home/something/foo/bar/user/backup/

or simply rsync -avs /home/something/foo/bar/user/htdocs/ /home/something/foo/bar/user/backup/

but obviously we need to get the files local. The docs say to use the host, Is this possible? my host is localhost obviously.

The following do not work (which i kind of expected but what should it be. rsync is very vague about this configuration

rsync -avs /home/hp3-linc1-nfs1-x/293/35293/user/htdocs/  [email protected]:/home/backup/sync

rsync -avs /home/hp3-linc1-nfs1-x/293/35293/user/htdocs/  root@localhost:/home/backup/sync

rsync -avs /home/hp3-linc1-nfs1-x/293/35293/user/htdocs/  [email protected]:/home/backup/sync

rsync -avs /home/hp3-linc1-nfs1-x/293/35293/user/htdocs/  [email protected]:/home/backup/sync

rsync -avs /home/hp3-linc1-nfs1-x/293/35293/user/htdocs/  user@localhost:/home/backup/sync

rsync -avs /home/hp3-linc1-nfs1-x/293/35293/user/htdocs/  [email protected]:/home/backup/sync

Any pointers would be well received.

The intention is to reintegrate our internal backup system with fasthosts (who appear to have a policy to lockout all backup methods so the paid service is used)

Upvotes: 1

Views: 977

Answers (1)

user1977661
user1977661

Reputation: 263

Run rsync locally, with the server's username & hostname/IP as the rsync source location

rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress user@server:/home/something/foo/bar/user/htdocs/  /home/something/foo/bar/user/backup/

you might not need StrictHostKeyChecking & UserKnownHostsFile

Upvotes: 1

Related Questions