面向云技术架构 - 痴者工良

  • 首页
  • 工良写的电子书
    • kubernetes 教程
    • 从 C# 入门 Kafka
    • 多线程和异步
    • 动态编程-反射、特性、AOP
    • 表达式树
  • 本站文章导航
  • 隐私政策
愿有人陪你颠沛流离
遇到能让你付出的事物或者人,都是一种运气。
能遇到,就该珍惜。或许你们最终没能在一起,但你会切实地感受到力量。
正因为这样,那段相遇才变得有价值,才没有辜负这世间的每一段相遇。
  1. 首页
  2. 笔记和吹水
  3. 代码片段
  4. 正文

Linux 免密登录的简便方法

2021年8月4日 1150点热度 1人点赞 0条评论
内容纲要

为了配置 Linux 免密登录,之前找到方法都是比较麻烦的,后面发现一种只需要两个步骤就能完成免密登录配置的方法。

假如,在 Linux A 免密登录 Linux B。
那么在 A 上生成 私钥公钥:

ssh-keygen

生成后,将公钥推送到 B 中:

 ssh-copy-id <user>@<ip>

接着输入免密

然后会提示:

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '192.168.0.111 (192.168.0.111)' can't be established.
ECDSA key fingerprint is SHA256:I0oyroOY3138C6+FTfbTPwqQYCuREc2lRHnSheRE3y8.
ECDSA key fingerprint is MD5:4f:bd:c5:b1:02:fd:a3:4b:14:08:be:47:b3:b5:2d:b5.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
afas@192.168.0.111's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'afas@192.168.0.111'"
and check to make sure that only the key(s) you wanted were added.

之后就可以直接免密登录了。

可以在 ~/home/.ssh 命令下看到生成的密钥文件。

* authorized_keys:存放远程免密登录的公钥,主要通过这个文件记录多台机器的公钥(初始不存在该文件) *
* id_rsa : 生成的私钥文件 *
* id_rsa.pub : 生成的公钥文件*
* know_hosts : 已知的主机公钥清单*
本作品采用 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 进行许可
标签: linux 免密 方法 登录 简便
最后更新:2021年10月6日

痴者工良

高级程序员劝退师

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

COPYRIGHT © 2022 whuanle.cn. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

粤ICP备18051778号

粤公网安备 44030902003257号