服务器与服务器进行scp,备份时都需要密码的认证造成了很多不便,以及安全的隐患,利用ssh的证书认证可以方便的进行备份与拷贝,提高了安全性能。
方法如下:
在服务器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:
然后进行
scp id_rsa.pub ip:.ssh/authorized_keys
cat id_rsa.pub >> authorized_keys
拷贝到服务器B上,然后再服务器B上重复A的操作即完成双向认证。
注:如果没有root下没有.ssh请建立一个即可。
阅读(1458) | 评论(0) | 转发(0) |