0

I just completed a magento website online, but I don't have any of the files on my local hard drive (couldn't install it on MAMP). But I would like to make a back up.

My hosting company lets me connect to the server through SSH on my mac terminal.

My question is, what is the line of command to copy from server to local drive?

With a sample path and/or example would be nice...and I'm also guessing it is a good idea to tar it before hand, how do I do that?

Thanks for the help.

4 Answers 4

3

If you're running Linux locally, you can use scp (secure copy) to transfer files from:

  • remote to local

  • local to remote

  • remote to remote

Syntax for remote to local:

scp username@server:/remote/path/to/file /path/to/local/dir

If you're transferring many files, it's probably a good idea to tar the files. Here's a reference on the tar syntax and options you may want:

http://www.computerhope.com/unix/utar.htm

2

You should use rsync over ssh to make the backup:

$ rsync -avz -e ssh remotehost:/path/to/site /local/backup/directory/

It's restartable and only transfers what you need.

2

If you want to save a tar file on your mac, here is another option.

ssh user@server '( cd /remote/path/ && tar cfz - . )' > site_backup.tar.gz

This option uses no extra disk space on the remote machine. It creates the tar file and immediately pushes it out over the ssh connection and saves it on your Mac.

3
  • I get this error in the terminal, do you know what it means? or what I need to do? "tar: Old option `f' requires an argument"
    – denislexic
    Aug 12, 2011 at 7:00
  • hmm, try this: ssh user@server '( cd /remote/path && tar cf - . | gzip -9 )' > site_backup.tar.gz Aug 12, 2011 at 7:17
  • f should be last: tar czf
    – Eelvex
    Aug 12, 2011 at 9:11
-1

You can use WinSCP as a windows client if you need to transfer files from a remote server to a local windows machine via SSH.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .