scp -r 远程源用户名@远程源IP:复制源文件绝对路径 目标路径
scp -r 远程源用户名@远程源IP:复制源文件绝对路径 远程目标用户名@远程目标IP:目标绝对路径
##失败:格式错误
ubuntu@shelltest:~/shelltest$scp ubuntu@123.206.222.333:/home/ubuntu/xjy /
Warning: Permanently added '123.206.222.333' (ECDSA) to the list of known hosts.
ubuntu@123.206.222.333's password:
scp: /home/ubuntu/xjy: not a regular file
##失败:格式错误
ubuntu@shelltest:~/shelltest$scp ubuntu@123.206.222.333:/home/ubuntu/xjy/ /
ubuntu@123.206.222.233's password:
scp: /home/ubuntu/xjy: not a regular file
##失败:格式错误
scp ubuntu@123.206.222.333:/home/ubuntu/xjy/* /
ubuntu@123.206.222.333's password:
scp: /home/ubuntu/xjy/HHS_sh: not a regular file
scp: /home/ubuntu/xjy/tcp_window: not a regular file
scp: /home/ubuntu/xjy/udp_window: not a regular file
##失败:密码输错
ubuntu@shelltest:~/shelltest$ scp ubuntu@123.206.222.333:/home/ubuntu/xjy/tcp_window/* /
ubuntu@123.206.222.333's password:
/1: Permission denied
/a.out: Permission denied
/tcps.c: Permission denied
##成功:成功把远程IP的tcp_winfow下的一级文件下载到当前目录
ubuntu@shelltest:~/shelltest$ scp ubuntu@123.206.222.333:/home/ubuntu/xjy/tcp_window/* ./
ubuntu@123.206.222.333's password:
1 100% 928 0.9KB/s 00:00
a.out 100% 9176 9.0KB/s 00:00
tcps.c 100% 928 0.9KB/s 00:00
##成功:成功把远程IP的tcp_winfow下的指定文件下载到当前目录
ubuntu@shelltest:~/shelltest$ scp ubuntu@123.206.222.333:/home/ubuntu/xjy/tcp_window/tcps.c ./
ubuntu@123.206.222.333's password:
tcps.c
ubuntu@shelltest:~/shelltest$ ll
total 1532
drwxrwxr-x 6 ubuntu ubuntu 4096 Apr 20 15:44 ./
drwxr-xr-x 8 ubuntu ubuntu 4096 Apr 20 15:43 ../
drwxrwxr-x 8 ubuntu ubuntu 4096 Sep 9 2016 .git/
-rw------- 1 ubuntu ubuntu 12288 Mar 31 15:31 .uc.c.swp
-rw-rw-r-- 1 ubuntu ubuntu 66 Sep 9 2016 Makefile
-rw-rw-r-- 1 ubuntu ubuntu 15 Sep 9 2016 README.md
-rwxrwxr-x 1 ubuntu ubuntu 9031 Mar 31 17:35 a.out*
-rw-rw-r-- 1 ubuntu ubuntu 997 Mar 31 14:53 c.c
drwxrwxr-x 2 ubuntu ubuntu 4096 Sep 9 2016 cat_tag_filename/
-rw-rw-r-- 1 ubuntu ubuntu 231375 Mar 1 10:01 libpcap-1.8.1.tar.gz
-rw-rw-r-- 1 ubuntu ubuntu 1147 Sep 9 2016 s.c
drwxrwxr-x 2 ubuntu ubuntu 4096 Nov 11 11:12 sctp/
-rw-rw-r-- 1 ubuntu ubuntu 1260309 Feb 2 19:53 tcpdump-4.9.0.tar.gz
-rw-rw-r-- 1 ubuntu ubuntu 928 Apr 20 15:44 tcps.c
drwxrwxr-x 3 ubuntu ubuntu 4096 Sep 14 2016 tt/
-rw-rw-r-- 1 ubuntu ubuntu 766 Mar 31 17:34 uc.c
##失败:这里是CSDN用户权限下载位置限制拒绝
ubuntu@shelltest:~/shelltest$ scp -r ubuntu@123.206.222.333:/home/ubuntu/xjy /
ubuntu@123.206.222.333's password:
/xjy: Permission denied
##成功:通过CSDN可以通过sudo拥有root权限,成功把远程IP的tcp_winfow下的多级文件下载到根目录
ubuntu@shelltest:~/shelltest$ sudo scp -r ubuntu@123.206.222.333:/home/ubuntu/xjy /
Warning: Permanently added '123.206.222.333' (ECDSA) to the list of known hosts.
ubuntu@123.206.222.333's password:
Makefile 100% 704 0.7KB/s 00:00
socket_sctp.c 100% 4264 4.2KB/s 00:00
socket_sctpex.h 100% 849 0.8KB/s 00:00
HSSdef.h 100% 11KB 11.4KB/s 00:00
HSSstruct.h 100% 2591 2.5KB/s 00:00
HSSser.c 100% 49KB 49.3KB/s 00:00
a.out 100% 13KB 13.3KB/s 00:00
udps.c 100% 2665 2.6KB/s 00:00
1 100% 928 0.9KB/s 00:00
a.out 100% 9176 9.0KB/s 00:00
tcps.c 100% 928 0.9KB/s 00:00
ubuntu@shelltest:~/shelltest$ cd /
ubuntu@shelltest:/$ ll
total 76
drwxr-xr-x 22 root root 4096 Apr 20 16:18 ./
drwxr-xr-x 22 root root 4096 Apr 20 16:18 ../
-rwxr-xr-x 1 root root 0 Apr 20 15:30 .dockerenv*
drwxr-xr-x 2 root root 4096 Mar 29 2016 bin/
drwxr-xr-x 2 root root 4096 Apr 11 2014 boot/
drwxr-xr-x 5 root root 360 Apr 20 15:30 dev/
drwxr-xr-x 92 root root 4096 Apr 20 15:30 etc/
drwxr-xr-x 3 root root 4096 Mar 29 2016 home/
drwxr-xr-x 13 root root 4096 Mar 29 2016 lib/
drwxr-xr-x 2 root root 4096 Mar 29 2016 lib64/
drwxr-xr-x 2 root root 4096 Oct 9 2015 media/
drwxr-xr-x 2 root root 4096 Apr 11 2014 mnt/
drwxr-xr-x 2 root root 4096 Oct 9 2015 opt/
dr-xr-xr-x 254 root root 0 Apr 20 15:30 proc/
drwx------ 3 root root 4096 Apr 20 16:18 root/
drwxr-xr-x 9 root root 4096 Apr 20 15:30 run/
drwxr-xr-x 2 root root 4096 Mar 29 2016 sbin/
drwxr-xr-x 2 root root 4096 Oct 9 2015 srv/
dr-xr-xr-x 13 root root 0 Apr 20 15:30 sys/
drwxrwxrwt 3 root root 4096 Mar 29 2016 tmp/
drwxr-xr-x 10 root root 4096 Oct 13 2015 usr/
drwxr-xr-x 12 root root 4096 Mar 29 2016 var/
drwxrwxr-x 5 root root 4096 Apr 20 16:18 xjy/
ubuntu@shelltest:/$ sudo rm -r xjy
##成功:成功把远程IP的tcp_winfow下的多级文件下载到当前目录
ubuntu@shelltest:~/shelltest$ scp -r ubuntu@123.206.222.333:/home/ubuntu/xjy ./
ubuntu@123.206.222.333's password:
Makefile 100% 704 0.7KB/s 00:00
socket_sctp.c 100% 4264 4.2KB/s 00:00
socket_sctpex.h 100% 849 0.8KB/s 00:01
HSSdef.h 100% 11KB 11.4KB/s 00:00
HSSstruct.h 100% 2591 2.5KB/s 00:00
HSSser.c 100% 49KB 49.3KB/s 00:00
a.out 100% 13KB 13.3KB/s 00:00
udps.c 100% 2665 2.6KB/s 00:00
1 100% 928 0.9KB/s 00:00
a.out 100% 9176 9.0KB/s 00:00
tcps.c 100% 928 0.9KB/s 00:00
ubuntu@shelltest:~/shelltest$ ll
total 1536
drwxrwxr-x 7 ubuntu ubuntu 4096 Apr 20 16:06 ./
drwxr-xr-x 8 ubuntu ubuntu 4096 Apr 20 16:06 ../
drwxrwxr-x 8 ubuntu ubuntu 4096 Sep 9 2016 .git/
-rw------- 1 ubuntu ubuntu 12288 Mar 31 15:31 .uc.c.swp
-rw-rw-r-- 1 ubuntu ubuntu 66 Sep 9 2016 Makefile
-rw-rw-r-- 1 ubuntu ubuntu 15 Sep 9 2016 README.md
-rwxrwxr-x 1 ubuntu ubuntu 9176 Apr 20 15:59 a.out*
-rw-rw-r-- 1 ubuntu ubuntu 997 Mar 31 14:53 c.c
drwxrwxr-x 2 ubuntu ubuntu 4096 Sep 9 2016 cat_tag_filename/
-rw-rw-r-- 1 ubuntu ubuntu 231375 Mar 1 10:01 libpcap-1.8.1.tar.gz
-rw-rw-r-- 1 ubuntu ubuntu 1147 Sep 9 2016 s.c
drwxrwxr-x 2 ubuntu ubuntu 4096 Nov 11 11:12 sctp/
-rw-rw-r-- 1 ubuntu ubuntu 1260309 Feb 2 19:53 tcpdump-4.9.0.tar.gz
-rw-rw-r-- 1 ubuntu ubuntu 928 Apr 20 15:59 tcps.c
drwxrwxr-x 3 ubuntu ubuntu 4096 Sep 14 2016 tt/
-rw-rw-r-- 1 ubuntu ubuntu 766 Mar 31 17:34 uc.c
drwxrwxr-x 5 ubuntu ubuntu 4096 Apr 20 16:06 xjy/