服务器与服务器进行scp,备份时都需要密码的认证造成了很多不便,以及安全的隐患,利用ssh的证书认证可以方便的进行备份与拷贝,提高了安全性能。
然后进行
拷贝到服务器B上,然后再服务器B上重复A的操作即完成双向认证。
方法如下:
在服务器A上:创建密钥
[root@localhost ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
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:
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
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:
scp id_rsa.pub ip:.ssh/authorized_keys
注:如果没有root下没有.ssh请建立一个即可。
本文转自 mcshell 51CTO博客,原文链接:http://blog.51cto.com/mcshell/498468,如需转载请自行联系原作者