Downloading Folders to my Local via SSH

68

21

I am learning SSH as it seems there are no good SSH GUIs for Macs. I know how to make db dumps, cruise through the directories, etc, but the one last piece of the puzzle I need to learn is how to download folders/entire directories from the server and onto my local computer so I can then move them to another server.

Any help would be greatly appreciated.

Zach Smith

Posted 2010-12-16T16:26:54.540

Reputation: 805

Answers

97

scp -r user@host:/path/to/folder/ local-copy-of-folder

If you have SSH keys set up, you can tab-complete remote files/folders.

robert

Posted 2010-12-16T16:26:54.540

Reputation: 1 344

It has to be case sensitive. – Ricardo – 2018-03-29T11:07:47.187

14

you can scp - which will allow you to securely copy between hosts.

to learn more you can do man scp

Its located in /usr/bin on linux. SCP or secure copy command copies files and directories from one computer to another in batch. (For interactive user interface you can use SFTP as "user545035" stated. It encrypts all communication between the two machines.

$ scp my file remote.example.com:newfile
$ scp -r mydir remote.example.com:
$ scp remote.example.com:myfile .
$ scp -r remote.example.com:mydir .

TO specify an alternate username on the remote system, use the username@host syntax:

$ scp myfile solidariti@remote.example.com :

Useful options:

-p: Duplicate all file attributes (permissions, timestamps) when copying.

-r: Recursively copy a directory and its contents.

-v: Produce verbose output, useful for debugging.

SFTP (host|username@host) openssh-client located in the /usr/bin directory. The sftp program copies files interactively between two computers. (As opposed to scp, which copies files in batch.) The user interface is much like that of ftp.

$ sftp remote.example.com
password: ******
sftp> cd MyFiles
sftp> ls
README
...
sftp> get README
Fetching /home/solidariti/Myfiles/README to README

If you username is different from your local one, use the username@host argument:

$ sftp solidariti@remote.example.com

Hope this gets you on your way.

Solidariti

Posted 2010-12-16T16:26:54.540

Reputation:

6

It's just...

scp -r username@remote:/path/to/folder /dest/local/path

Andrew White

Posted 2010-12-16T16:26:54.540

Reputation: 271

3

I would look for an 'SFTP Client' and use that. Maybe FileZilla

davebryant

Posted 2010-12-16T16:26:54.540

Reputation:

1

Cyberduck was my favorite SSH/FTP/DAV GUI when I used a Mac. Looks like it's been updated to include Google Docs and S3 since then, too.

shiftycow

Posted 2010-12-16T16:26:54.540

Reputation: 81

0

if you have pem file you can use something like that

scp -i mypemfile.pem -r user@host:/path/to/folder/ local-copy-of-folder

bhavinjr

Posted 2010-12-16T16:26:54.540

Reputation: 101

If this is to be useful introduction to SCP then it needs more detail and explanation. – Daniel K – 2019-05-28T19:37:16.733