scp 无密码在两台主机之间拷贝文件

用scp 在两台主机之间相互之间拷贝文件,还是方面!但是需要密码!怎么样才能无密码相互之间拷贝文件呢!
以下就实现是方法!
在A主机上运行

ssh-keygen -t  rsa
[root@localhost ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
61:34:37:bd:03:aa:c8:85:0d:e9:d0:b6:6e:c2:50:89 root@localhost

这样会在/root/.ssh/有两个 id_rsa ,id_rsa.pub.

将id_rsa.pub复制目标服务器上的/root/.ssh/里,并改名authorized_keys
例如 scp /root/.ssh/is_rsa.pub root@B:/root/.ssh/authorized_keys
这样再次scp的时候,就不需要密码了。

转载请注明:快乐点点通 » scp 无密码在两台主机之间拷贝文件
继续查看有关 的文章

评论已关闭