1. 程式人生 > >基於證書的免密ssh

基於證書的免密ssh

A:
[[email protected] .ssh]# history
1 ssh-keygen -t rsa //建立公私鑰匙對
2 ll
3 scp id_rsa.pub [email protected]:/root/.ssh/authorized_keys 將公鑰傳送到被請求端並更名為authorized_keys
4 systemctl restart sshd 重啟服務
5 ssh [email protected]
在這裡插入圖片描述
B:
1 ssh-keygen -t rsa
2 ll
3 scp id_rsa.pub [email protected]

:/root/.ssh/authorized_keys
6 systemctl restart sshd
5 ssh [email protected]
在這裡插入圖片描述

A B 需同時將自己的公鑰傳送給被對方,才能互信
2.
先將私鑰下載至windows,後將公鑰改名為authorized_keys,並在windows認證方式用私鑰去嘗試直接登陸。
在這裡插入圖片描述
在這裡插入圖片描述在這裡插入圖片描述在這裡插入圖片描述
測試成功。