ssh 无密码设置
时间:2010-10-02 来源:wbwk2005
情景:服务器A 通过ssh 服务器B无需输入密码,像可以用于crontab执行rsync等服务中
aip:192.168.16.240 bip:192.168.95.200
第一步:First log in on A as user a and generate a pair of authentication keys
转到root目录下,执行以下命令
a@A:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa):
Created directory '/home/a/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/a/.ssh/id_rsa.
Your public key has been saved in /home/a/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A
此时就会在A机器的当前用户的根目录下产生一个私钥跟公钥文件,下一步需要将公钥文件拷贝到B机器上
第二步:
a@A:~>scp /a/.ssh/id_rsa.pub
aip:192.168.16.240 bip:192.168.95.200
第一步:First log in on A as user a and generate a pair of authentication keys
转到root目录下,执行以下命令
a@A:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa):
Created directory '/home/a/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/a/.ssh/id_rsa.
Your public key has been saved in /home/a/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A
此时就会在A机器的当前用户的根目录下产生一个私钥跟公钥文件,下一步需要将公钥文件拷贝到B机器上
第二步:
a@A:~>scp /a/.ssh/id_rsa.pub
相关阅读 更多 +