How do I copy a folder from remote to local using

2020-01-29 23:06发布

How do I copy a folder from remote to local host using scp?

I use ssh to log in my server.
Then, I would like to copy the remote folder foo to local /home/user/Desktop.

How do I achieve this?

11条回答
Rolldiameter
2楼-- · 2020-01-29 23:50

And if you have one hell of a files to download from the remote location and if you don't much care about security, try changing the scp default encryption (Triple-DES) to something like 'blowfish'.

This will reduce file copying time drastically.

scp -c blowfish -r user@your.server.example.com:/path/to/foo /home/user/Desktop/
查看更多
混吃等死
3楼-- · 2020-01-29 23:51

Go to Files on your unity toolbar

enter image description here

Press Ctrl + l and write here_goes_your_user_name@192.168.10.123

The 192.168.1.103 is the host that you want to connect.

The here one example

enter image description here

查看更多
啃猪蹄的小仙女
4楼-- · 2020-01-29 23:51

Typical scenario,

scp -r -P port username@ip:/path-to-folder  .

explained with an sample,

scp -r -P 27000 abc@10.70.12.12:/tmp/hotel_dump .

where,

port = 27000
username = "abc" , remote server username
path-to-folder = tmp/hotel_dump
. = current local directory
查看更多
\"骚年 ilove
5楼-- · 2020-01-29 23:52
scp -r user@your.server.example.com:/path/to/foo /home/user/Desktop/

From man scp (See online manual)

-r Recursively copy entire directories

查看更多
走好不送
6楼-- · 2020-01-29 23:53

In case you run into "Too many authentication failures", specify the exact SSH key you have added to your severs ssh server:

scp -r -i /path/to/local/key user@remote.tld:/path/to/folder /your/local/target/dir
查看更多
\"骚年 ilove
7楼-- · 2020-01-29 23:55

To copy all from Local Location to Remote Location (Upload)

scp -r /path/from/destination username@hostname:/path/to/destination

To copy all from Remote Location to Local Location (Download)

scp -r username@hostname:/path/from/destination /path/to/destination

Custom Port where xxxx is custom port number

 scp -r -P xxxx username@hostname:/path/from/destination /path/to/destination

Copy on current directory from Remote to Local

scp -r username@hostname:/path/from/file .

Help:

  1. -r Recursively copy all directories and files
  2. Always use full location from /, Get full location by pwd
  3. scp will replace all existing files
  4. hostname will be hostname or IP address
  5. if custom port is needed (besides port 22) use -P portnumber
  6. . (dot) - it means current working directory, So download/copy from server and paste here only.

Note: Sometimes the custom port will not work due to the port not being allowed in the firewall, so make sure that custom port is allowed in the firewall for incoming and outgoing connection

查看更多
登录 后发表回答