SSH download file from web server

1

I need to do a backup on a website, but I need to download locally to a folder on my hard drive.

Example: scp name.zip -> MyMac/Documents/Backup

This can be done via shell, Terminal, etc. What is the best method for this?

Thomas

Posted 2012-01-31T23:58:11.247

Reputation: 11

Answers

5

scp [user@]vps.example.com:name.zip ~/Documents/Backup/ will do what you want.

The scp(1) manual page has the details, but the syntax scp ${from} ${to}, where from and to are of the form: ${host}:${path} or ${path}.

You might also be interested in sftp, which is an FTP-like interactive experience, rather than the command-line scp experience; sftp vps.example.com will get you going there.

Daniel Pittman

Posted 2012-01-31T23:58:11.247

Reputation: 3 510

Thank you for the answer.i try this scp vps.example.com:name.zip ~/Documents/Backup/ but not works – Thomas – 2012-02-01T00:34:08.393

1You will have to include the error message to have a hope of anyone else telling you why. Did you literally type vps.example.com in there? You can't just copy and paste my example, you need to use the name of your system and all. – Daniel Pittman – 2012-02-01T00:35:37.457

yes,i use my host and username..but "Permission denied, please try again." – Thomas – 2012-02-01T00:44:07.710

It could by the file has the wrong permissions, you got your login details wrong, the server only allows key based logins, or they have disabled scp. The last is very unlikely, though, because scp is very little different to ssh vps.example.com cat /path/to/file and all. – Daniel Pittman – 2012-02-01T01:00:23.127

In case it is unclear, you should run the command on your local machine. – Nathan Grigg – 2012-02-02T00:43:37.020