linux系统中scp命令实现服务器之间数据的传输

linux系统中scp命令实现服务器之间数据的传输

1、从本地服务器传输至另一台服务器

测试服务器连通性:

[root@centos79 test]# ifconfig | head -n 3   ## 查看本机服务器ip
ens32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.3.83  netmask 255.255.255.0  broadcast 192.168.3.255
        inet6 fe80::ede3:5653:e765:1b1a  prefixlen 64  scopeid 0x20<link>
[root@centos79 test]# ping -c 3 192.168.3.33   ## 测试与远程服务器连通性
PING 192.168.3.33 (192.168.3.33) 56(84) bytes of data.
64 bytes from 192.168.3.33: icmp_seq=1 ttl=64 time=4.02 ms
64 bytes from 192.168.3.33: icmp_seq=2 ttl=64 time=2.42 ms
64 bytes from 192.168.3.33: icmp_seq=3 ttl=64 time=2.23 ms

--- 192.168.3.33 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 2.239/2.895/4.027/0.804 ms

 

2、将本地文件传输至远程服务器

[root@centos79 test]# ls
outcome.map  outcome.ped
[root@centos79 test]# scp outcome.map root@192.168.3.33:/home/test/
root@192.168.3.33's password:                                ## 这里要输入远程服务器对应用户(这里是root)的密码
outcome.map                                                                                        100% 1315KB   6.5MB/s   00:00

 

3、将远程服务器文件传输至本地服务器

[root@centos79 test]# ls
outcome.map  outcome.ped
[root@centos79 test]# scp root@192.168.3.33:/home/test/test.txt ./
root@192.168.3.33's password:
test.txt                                                                                           100%   22     3.6KB/s   00:00
[root@centos79 test]# ls
outcome.map  outcome.ped  test.txt

 

上一篇:linux命令之scp


下一篇:centosde 启动流程与安全加固selinux