Linux 实现密钥登录

环境如下:

主机名 IP 备注
vm201 172.20.128.31 ansible后者salt服务器
vm203 172.20.128.33 客户端机器

需求

我们想在主机名为vm201的机器上能密钥登录所有的客户机,也就是可以免密码登录所有的客户端机器。

 

解决

(1)在服务端vm201的机器上生成公钥和私钥

[www@vm201 ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/www/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/www/.ssh/id_rsa.
Your public key has been saved in /home/www/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:H9VYYyonRm2OfETQuocot7NdCeYkMmGsevc8xgAJpxI www@vm201-db-master
The key's randomart image is:
+---[RSA 2048]----+
|          o=. +  |
|E . ..   .  =* . |
| . + .+  .+*= .  |
|. . oo . .
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章