设有两机,均为局域网,两机可相互通信无问题,中间无防火墙。 两机IP分别为:A:192.168.1.240 B:192.168.1.102 假设A,B机的SSH都允许root登录 设要把 A上的 /root/abc.zip 传到 B机并放到/abc目录,可以在A机上用命令 scp /root/abc.zip [email protected]:/abc/ 若 SSH端口不是默认的22,比如,是端口1234 则加-P参数: scp -P 1234 /root/abc.zip [email protected]:/abc/ 也可以在B机上用命令: scp [email protected]:/root/abc.zip /abc/ 下面给出一个例子,希望你看得懂: [[email protected] ~]# pwd /root [[email protected] ~]# ls anaconda-ks.cfg ftpaccount install.log.syslog backup.tar.gz install.log svn1.4.3 [[email protected] ~]# scp backup.tar.gz [email protected]:/tmp/ The authenticity of host ‘192.168.1.21 (192.168.1.21)‘ can‘t be established. RSA key fingerprint is 4d:b4:e1:5b:80:8f:ea:df:0a:eb:dd:30:e7:00:07:90. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added ‘192.168.1.21‘ (RSA) to the list of known hosts. [email protected]‘s password: << 提示输入192.168.1.21的SSH密码 backup.tar.gz 100% 5120KB 1.3MB/s 00:04 [[email protected] ~]#
时间: 2024-10-31 08:09:31