03_ssh免密登入及原理

https://www.jianshu.com/p/0f9b72d691c2

https://www.cnblogs.com/276815076/p/10449354.html

https://note.youdao.com/web/#/file/recent/note/7E4D82F672AF437789C359C9C6B1A533/?search=%E5%85%8D%E5%AF%86&count=1

1.前提:假设 机器A为客户端  机器B为服务端 (机器A登入机器B免密)

2.在机器A上生成公钥、私钥

ssh-keygen
#生成后的公钥、私钥 存放在/root/.ssh/下的id_rsa、id_rsa.pub

3.将机器A的公钥内容追加到机器B的授权文件中去(/root/.ssh/authorized_keys)

scp id_rsa.pub root@机器B:/root/.ssh/authorized_keys

4.当机器B上没有/root/.ssh 目录时需要创建后再执行步骤3

ssh root@机器B “mkdir /root/.ssh”

  

posted @ 2020-05-21 09:42  学而不思则罔!  阅读(170)  评论(0编辑  收藏  举报