scp远程复制命令

1.什么是scp

使用 man scp查看文档描述如下

scp copies files between hosts on a network. It uses ssh(1) for data transfer, and uses the same authentication and provides the same security as ssh(1). Unlike rcp(1), scp will ask for passwords or passphrases if they are needed for authentication.
File names may contain a user and host specification to indicate that the file is to be copied to/from that host. Local file names can be made explicit using absolute or relative pathnames to avoid scp treating file names containing ‘:’ as host specifiers. Copies between two remote hosts are also per‐mitted.

2.使用方式

scp option file_source file_target

3.从本地复制文件到远程主机

$ scp failname remote_user_name@remote_url:filename

4.从远程复制文件到本地

$ scp remote_user_name@remote_url:filename failname

5.两个远程主机复制

# 有些主机可能不支持此种方式
$ scp remote1_user_name@remote1_url:filename remote2_user_name@remote2_url:filename

6.常用选项

-B: 使用批处理模式(传输过程中不询问传输口令或短语)
-C: 允许压缩。(将-C标志传递给ssh,从而打开压缩功能)
-p:保留原文件的修改时间,访问时间和访问权限。
-r: 递归复制整个目录。
-v:详细方式显示输出。scp和ssh(1)会显示出整个过程的调试信息。这些信息用于调试连接,验证和配置问题。
-F ssh_config: 指定一个替代的ssh配置文件,此参数直接传递给ssh。
-P port:注意是大写的P, port是指定数据传输用到的端口号
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值