linux之间使用scp拷贝数据

设有两机,两机可相互通信无问题,中间无防火墙。

两机IP分别为:A:218.29.54.240 B:218.29.54.231

假设A,B机的SSH都允许root登陆

现在需要将218.29.54.240 root目录下的cacti-0.8.7g.tar.gz 拷贝到218.29.54.231 的root下

则登陆218.29.54.240使用

[root@hn ~]# scp cacti-0.8.7g.tar.gz root@218.29.54.231:/root/
The authenticity of host '218.29.54.231 (218.29.54.231)' can't be established.
RSA key fingerprint is 4a:5c:48:b7:1c:17:3f:2c:60:b4:a2:65:b3:cb:fe:ff.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '218.29.54.231' (RSA) to the list of known hosts.
Address 218.29.54.231 maps to hn.kd.ny.adsl, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
root@218.29.54.231's password:   这里输入218.29.54.231的ssh密码
cacti-0.8.7g.tar.gz                 100% 2184KB   2.1MB/s   00:00

登陆218.29.54.231验证

[root@hn ~]# ls
anaconda-ks.cfg  cacti-0.8.7g.tar.gz  Desktop  install.log  install.log.syslog

如果218.29.54.231的ssh端口不是默认的话,比如是47457则在218.29.54.240上

[root@hn ~]# scp -P 47457 cacti-0.8.7g.tar.gz root@218.29.54.231:/root/
Address 218.29.54.231 maps to hn.kd.ny.adsl, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
root@218.29.54.231's password:
cacti-0.8.7g.tar.gz                 100% 2184KB   2.1MB/s   00:00   

或者可以在218.29.54.231上使用

[root@hn ~]# scp root@218.29.54.240:/root/cacti-0.8.7g.tar.gz /root/
The authenticity of host '218.29.54.240 (218.29.54.240)' can't be established.
RSA key fingerprint is 4a:5c:48:b7:1c:17:3f:2c:60:b4:a2:65:b3:cb:fe:ff.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '218.29.54.240' (RSA) to the list of known hosts.
Address 218.29.54.240 maps to hn.kd.ny.adsl, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
root@218.29.54.240's password:
cacti-0.8.7g.tar.gz                 100% 2184KB   2.1MB/s   00:00
[root@hn ~]# ls
anaconda-ks.cfg  cacti-0.8.7g.tar.gz  Desktop  install.log  install.log.syslog