[root@localhost ~]# scp importantfile admin@10.0.0.6:/home/admin/ The authenticity of host '10.0.0.6 (10.0.0.6)' can't be established. RSA key fingerprint is SHA256:LqBzkeGa6K9BfWWKgcKlQoE0u+gjorX0lPLx5YftX1Y. RSA key fingerprint is MD5:ed:44:42:59:3e:dd:4c:12:43:4a:89:b1:5d:bd:9e:20. Are you sure you want tocontinue connecting (yes/no)? yes Warning: Permanently added '10.0.0.6' (RSA) to the list of known hosts. admin@10.0.0.6's password: importantfile 100%00.0KB/s 00:00 [root@localhost ~]#
类似的,如果你想从一个远程主机中取得文件,你可以利用如下的 scp 命令。
1 2 3 4 5 6 7 8 9
[root@localhost ~]# scp root@10.10.16.137:/root/importantfile /home/admin/ The authenticity of host '10.10.16.137 (10.10.16.137)' can't be established. RSA key fingerprint is b0:b0:a3:c3:2e:94:13:0c:29:2e:ba:0b:d3:d6:12:8f. Are you sure you want tocontinue connecting (yes/no)? yes Warning: Permanently added '10.10.16.137' (RSA) to the list of known hosts. root@10.10.16.137's password: importantfile 100%00.0KB/s 00:00 [root@localhost ~]#
你也可以像 cp 命令一样,在 scp 命令中使用不同的选项,scp 的 man 帮助详细地阐述了不同选项的用法和用处。