Linux环境SSH登录使用RSA证书认证代替密码

当您在Linux下使用cvs命令时,每交提交、查询状态、更新等操作都要输入密码,实在是不方便。有没有办法不输入密码?

当然,SSH的支持多种认证方式,我们可以使用公钥和私钥的方式来认证。下面来介绍具体的做法,假设两台Linux服务器:server1和server2,我们以用户dboper为例(即两台服务器上均创建有dboper用户)。

在server1上,以dboper登录。执行如下命令:

ssh-keygen -d

Generating public/private dsa key pair.

Enter file in which to save the key (/home/wuysh/.ssh/id_dsa): (采用缺省值,回车)

Enter passphrase (empty for no passphrase): (不用密码了,回车)

Enter same passphrase again: (回车)

Your identification has been saved in /home/wuysh/.ssh/id_dsa.

Your public key has been saved in /home/wuysh/.ssh/id_dsa.pub.

The key fingerprint is:

b2:a4:92:12:7f:15:9b:89:48:2a:7c:3a:d6:17:ea:ab dboper@localhost.localdomain

这样,在用户的.ssh目录下生成如下两个文件:

id_dsa

id_dsa.pub

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wzyxws.html