SCP 使用
SCP 不输入密码两台LINUX主机之间建立信任关系之后,可不输入密码即可相互传送文件。
例如:主机A与主机B
1、在A的当前用户(例如oracle)下,运行
#ssh-keygen -t rsa
Generating public/private rsa key pair.Enter file in which to save the key (/home/oracle/.ssh/id_rsa):#回车Enter passphrase (empty for no passphrase):#回车Enter same passphrase again:#回车Your identification has been saved in /home/oracle/.ssh/id_rsa.Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.The key fingerprint is:07:0d:3c:cc:43:b7:c6:44:86:71:ff:03:a9:e1:43:d1 oracle@A.x.x.com
会在用户目录~/.ssh/产生两个文件,id_rsa与id_rsa.pub。
2、拷贝 id_rsa.pub到B的.ssh/authorized_keys,这样再次运行scp oracle@B.x.x.com:/home/oracle/test.txt test.txt,则不需要输入密码了!
<div class="quote_title">引用
页:
[1]