scp

安全拷贝(远程文件复制程序)

语法

  scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
         [-l limit] [-o ssh_option] [-P port] [-S program]
            [ [user@]host1:]file1 [...] [ [user@]host2:]file2

scp用于网络上的主机之间复制文件。它使用ssh(1)进行数据传输,使用与ssh(1)相同的身份验证并提供相同的安全性。与rcp不同的是,scp在需要身份验证时,会要求输入密码或密码口令

任何文件名都可以包含主机和用户规范,以指示要将文件复制到该主机或从该主机复制该文件.
允许在两个远程主机之间互相复制.

选项:

-1' 强制scp使用协议1.

-2' 强制scp使用协议2.

-4' 强制scp仅使用IPv4地址.

-6' 强制scp仅使用IPv6地址.

-B' 选择批处理模式(不要求密码或密码口令)

-C' 压缩

-c cipher
选择用于加密数据传输的密码。
此选项直接传递给ssh(1)

-F ssh_config
为ssh指定备用的每用户配置文件。
此选项直接传递给ssh(1)

-i identity_file
 选择用于RSA身份验证的身份(私钥)读取的文件。这个选项直接传递给ssh

-l limit
 限制使用的带宽,以 Kbit/s为单位.

-o ssh_option
可用于以ssh_config中使用的格式将选项传递给ssh(1).
这对于指定没有单独scp命令行标志的选项非常有用.

有关下面列出的选项及其可能值的完整详细信息,
see ssh_config(5).

AddressFamily
BatchMode
BindAddress
ChallengeResponseAuthentication
CheckHostIP
Cipher
Ciphers
Compression
CompressionLevel
ConnectionAttempts
ConnectTimeout
ControlMaster
ControlPath
GlobalKnownHostsFile
GSSAPIAuthentication
GSSAPIDelegateCredentials
HashKnownHosts
Host'
HostbasedAuthentication
HostKeyAlgorithms
HostKeyAlias
HostName
IdentityFile
IdentitiesOnly
KbdInteractiveDevices
LogLevel
MACs'
NoHostAuthenticationForLocalhost
NumberOfPasswordPrompts
PasswordAuthentication
Port'
PreferredAuthentications
Protocol
ProxyCommand
PubkeyAuthentication
RekeyLimit
RhostsRSAAuthentication
RSAAuthentication
SendEnv
ServerAliveInterval
ServerAliveCountMax
SmartcardDevice
StrictHostKeyChecking
TCPKeepAlive
UsePrivilegedPort
User'
UserKnownHostsFile
VerifyHostKeyDNS

-P port
184/5000  
     远程主机上要连接的端口。
     注意,这个选项是用大写的“P”编写的,
     因为-p已经预留给rcp(1)中保存文件的时间和模式。
-p'  保留原始文件的修改时间,访问时间和模式

-q' 禁用进度表。

-r' 递归复制整个目录

-S program
用于加密连接的程序名称
该程序必须了解ssh(1)选项

-v' 详细模式.
    导致scp和ssh(1)打印有关其进度的调试消息。
    这有助于调试连接,身份验证和配置问题。

scp在成功时退出0或者如果发生错误则退出> 0

例子

将file1复制到远程主机:

 $ scp /home/simon/file1 kate@rootopen.com:/home/kate

scp 命令实例:

linux命令:scp~ / names.txt root@192.168.56.10 :/root/names.txt :/root/names.txt root@192.168.56.10 names.txt / scp~ scp~ / names.txt root@192.168.56.10 :/root/names.txtrootopen.com
linux命令:scp~ / names.txt root@192.168.56.10 :/root/names.txt :/root/names.txt root@192.168.56.10 names.txt / scp~ scp~ / names.txt root@192.168.56.10 :/root/names.txtrootopen.com
2018-09-11 09:55:30

linux命令:scp user@hostb:file user@hostc: user@hostc: user@hostb:file scp scp user@hostb:file user@hostc:rootopen.com
linux命令:scp user@hostb:file user@hostc: user@hostc: user@hostb:file scp scp user@hostb:file user@hostc:rootopen.com
2017-12-30 14:24:48

linux命令:scp -P 22 /home/svnlabs.txt root@92.178.0.56:/home/svnlabs.txt root@92.178.0.56:/home/svnlabs.txt /home/svnlabs.txt 22 -P scp scp -P 22 /home/svnlabs.txt root@92.178.0.56:/home/svnlabs.txtrootopen.com
linux命令:scp -P 22 /home/svnlabs.txt root@92.178.0.56:/home/svnlabs.txt root@92.178.0.56:/home/svnlabs.txt /home/svnlabs.txt 22 -P scp scp -P 22 /home/svnlabs.txt root@92.178.0.56:/home/svnlabs.txtrootopen.com
2018-02-06 18:23:48

linux命令:scp -P 22 /home/svnlabs.txt root@92.178.0.56:/home/svnlabs.txt root@92.178.0.56:/home/svnlabs.txt /home/svnlabs.txt 22 -P scp scp -P 22 /home/svnlabs.txt root@92.178.0.56:/home/svnlabs.txtrootopen.com
linux命令:scp -P 22 /home/svnlabs.txt root@92.178.0.56:/home/svnlabs.txt root@92.178.0.56:/home/svnlabs.txt /home/svnlabs.txt 22 -P scp scp -P 22 /home/svnlabs.txt root@92.178.0.56:/home/svnlabs.txtrootopen.com
2018-04-20 15:26:48

linux命令:scp /home/svnlabs.txt root@92.178.0.56:/home/ root@92.178.0.56:/home/ /home/svnlabs.txt scp scp /home/svnlabs.txt root@92.178.0.56:/home/rootopen.com
linux命令:scp /home/svnlabs.txt root@92.178.0.56:/home/ root@92.178.0.56:/home/ /home/svnlabs.txt scp scp /home/svnlabs.txt root@92.178.0.56:/home/rootopen.com
2018-02-23 01:49:48

linux命令:scp -C 10.0.0.4:/tmp/backup.sql /path/to/backup.sql /path/to/backup.sql 10.0.0.4:/tmp/backup.sql -C scp scp -C 10.0.0.4:/tmp/backup.sql /path/to/backup.sqlrootopen.com
linux命令:scp -C 10.0.0.4:/tmp/backup.sql /path/to/backup.sql /path/to/backup.sql 10.0.0.4:/tmp/backup.sql -C scp scp -C 10.0.0.4:/tmp/backup.sql /path/to/backup.sqlrootopen.com
2018-04-09 05:34:48

linux命令:scp -l10 pippo@serverciccio:/home/zutaniddu/* . . pippo@serverciccio:/home/zutaniddu/* -l10 scp scp -l10 pippo@serverciccio:/home/zutaniddu/* .rootopen.com
linux命令:scp -l10 pippo@serverciccio:/home/zutaniddu/* . . pippo@serverciccio:/home/zutaniddu/* -l10 scp scp -l10 pippo@serverciccio:/home/zutaniddu/* .rootopen.com
2018-01-08 18:58:48

linux命令:scp $user@$server:$path/to/file . . $user@$server:$path/to/file scp scp $user@$server:$path/to/file .rootopen.com
linux命令:scp $user@$server:$path/to/file . . $user@$server:$path/to/file scp scp $user@$server:$path/to/file .rootopen.com
2018-03-03 17:17:48

linux命令:scp ~/.ssh/id_rsa.pub user@remote:.ssh/authorized_keys user@remote:.ssh/authorized_keys ~/.ssh/id_rsa.pub scp scp ~/.ssh/id_rsa.pub user@remote:.ssh/authorized_keysrootopen.com
linux命令:scp ~/.ssh/id_rsa.pub user@remote:.ssh/authorized_keys user@remote:.ssh/authorized_keys ~/.ssh/id_rsa.pub scp scp ~/.ssh/id_rsa.pub user@remote:.ssh/authorized_keysrootopen.com
2018-04-01 12:09:48

linux命令:scp -P 2202 /$filelocation user@host:/$final/$location user@host:/$final/$location /$filelocation 2202 -P scp scp -P 2202 /$filelocation user@host:/$final/$locationrootopen.com
linux命令:scp -P 2202 /$filelocation user@host:/$final/$location user@host:/$final/$location /$filelocation 2202 -P scp scp -P 2202 /$filelocation user@host:/$final/$locationrootopen.com
2018-05-10 18:32:48

linux命令:scp -i /path/to/file.pem [local-files] root@[dest-host]:[dest-path] root@[dest-host]:[dest-path] [local-files] /path/to/file.pem -i scp scp -i /path/to/file.pem [local-files] root@[dest-host]:[dest-path]rootopen.com
linux命令:scp -i /path/to/file.pem [local-files] root@[dest-host]:[dest-path] root@[dest-host]:[dest-path] [local-files] /path/to/file.pem -i scp scp -i /path/to/file.pem [local-files] root@[dest-host]:[dest-path]rootopen.com
2018-02-06 12:53:48

linux命令:scp -P 1837 <path_to_loca_file> <remote_user>@<remote_ip>:<remote_ip> <remote_user>@<remote_ip>:<remote_ip> <path_to_loca_file> 1837 -P scp scp -P 1837 <path_to_loca_file> <remote_user>@<remote_ip>:<remote_ip>rootopen.com
linux命令:scp -P 1837 <path_to_loca_file> <remote_user>@<remote_ip>:<remote_ip> <remote_user>@<remote_ip>:<remote_ip> <path_to_loca_file> 1837 -P scp scp -P 1837 <path_to_loca_file> <remote_user>@<remote_ip>:<remote_ip>rootopen.com
2018-03-01 00:06:48

linux命令:scp filename root@remote:`pwd` root@remote:`pwd` filename scp scp filename root@remote:`pwd`rootopen.com
linux命令:scp filename root@remote:`pwd` root@remote:`pwd` filename scp scp filename root@remote:`pwd`rootopen.com
2018-01-26 04:55:48

linux命令:scp -l username -pw pa33w0rd file.txt 192.168.1.2:/path/to/dir 192.168.1.2:/path/to/dir file.txt pa33w0rd -pw username -l scp scp -l username -pw pa33w0rd file.txt 192.168.1.2:/path/to/dirrootopen.com
linux命令:scp -l username -pw pa33w0rd file.txt 192.168.1.2:/path/to/dir 192.168.1.2:/path/to/dir file.txt pa33w0rd -pw username -l scp scp -l username -pw pa33w0rd file.txt 192.168.1.2:/path/to/dirrootopen.com
2018-06-06 02:15:48

linux命令:scp username@host|ipaddress:/directory/path . . username@host|ipaddress:/directory/path scp scp username@host|ipaddress:/directory/path .rootopen.com
linux命令:scp username@host|ipaddress:/directory/path . . username@host|ipaddress:/directory/path scp scp username@host|ipaddress:/directory/path .rootopen.com
2018-03-29 13:36:48

linux命令:scp user@hostname:/remotedir/file.name /localdir /localdir user@hostname:/remotedir/file.name scp scp user@hostname:/remotedir/file.name /localdirrootopen.com
linux命令:scp user@hostname:/remotedir/file.name /localdir /localdir user@hostname:/remotedir/file.name scp scp user@hostname:/remotedir/file.name /localdirrootopen.com
2018-03-13 12:57:48

linux命令:scp username@computer:"path/To/File1 path/To/File2" destination/ destination/ path/To/File2" username@computer:"path/To/File1 scp scp username@computer:"path/To/File1 path/To/File2" destination/rootopen.com
linux命令:scp username@computer:"path/To/File1 path/To/File2" destination/ destination/ path/To/File2" username@computer:"path/To/File1 scp scp username@computer:"path/To/File1 path/To/File2" destination/rootopen.com
2018-01-18 05:10:48

linux命令:scp -r `ls | grep -vE "(Pattern1|Pattern2)"` user@remote_host:/location user@remote_host:/location "(Pattern1|Pattern2)"` -vE grep | `ls -r scp scp -r `ls | grep -vE "(Pattern1|Pattern2)"` user@remote_host:/locationrootopen.com
linux命令:scp -r `ls | grep -vE "(Pattern1|Pattern2)"` user@remote_host:/location user@remote_host:/location "(Pattern1|Pattern2)"` -vE grep | `ls -r scp scp -r `ls | grep -vE "(Pattern1|Pattern2)"` user@remote_host:/locationrootopen.com
2018-04-12 07:51:48

Linux的Bash命令行(A-Z排序)