服务器之间的文件下载(需要密码的scp方式或者无需密码两种方式)

目的

不考虑端口占用和安全等一系列问题的前提下
A服务器下载B服务器/usr/local/test.txt文件

方式一:scp命令从A服务器下载B服务器文件(需要被下载方服务器密码)

A服务器上执行scp命令,第一次会让你输入 yes 输入即可

scp B服务用户名@B服务器IP:B服务器文件 A服务器下载位置

示例如下

[root@MundaneGainsboro-VM ~]# scp root@10.10.10.55:/usr/local/test.txt /usr/local
The authenticity of host '10.10.10.55 (10.10.10.55)' can't be established.
ECDSA key fingerprint is SHA256:wCLefvWh8YANsx1ameRXjMq7zJtnHmr7+c45NHvzxyg.
ECDSA key fingerprint is MD5:04:40:ae:37:46:79:10:e0:c5:3d:95:aa:88:76:e9:68.
Are you sure you want to continue connecting (yes/no)? yes

然后输入B服务器密码即可完成传输

Warning: Permanently added '10.10.10.55' (ECDSA) to the list of known hosts.
root@10.10.10.55's password:
方式二:scp命令从B服务器上传到A服务器(需要接收方服务器密码)

B服务器上执行scp命令,第一次会让你输入 yes 输入即可

scp B服务器文件 A服务用户名@A服务器IP:A服务器上传位置

示例如下

[root@instance test]# scp /usr/local/test.txt root@10.10.10.78:/usr/local
The authenticity of host '10.10.10.78 (10.10.10.78)' can't be established.
ECDSA key fingerprint is SHA256:hB+LmYmiz4lZNnzJOJmy6J7vlPDdZBO+YWVelNFJuvA.
ECDSA key fingerprint is MD5:d6:c7:64:c6:a9:68:3d:18:21:11:4e:11:62:c7:8e:a1.
Are you sure you want to continue connecting (yes/no)? yes

然后输入A服务器密码即可完成传输

Warning: Permanently added '10.10.10.78' (ECDSA) to the list of known hosts.
root@10.10.10.78's password: 
方式三:python开启简单HTTP连接传输,较为简单无需密码

进入B服务器想要下载文件的目录

cd /usr/local

B服务器上用python创建一个简单的http服务,端口自定义这里是8888,保持连接

python -m SimpleHTTPServer 8888

A服务器运行命令下载,没有wget命令 yum -install -y wget 安装即可

wget http://B服务器IP:8888/test.txt
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值