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 . .
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章