前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ssh免密配置

ssh免密配置

作者头像
summerking
发布2022-09-19 11:07:34
6550
发布2022-09-19 11:07:34
举报
文章被收录于专栏:summerking的专栏

# 1.生成密钥私钥

代码语言:javascript
复制
[root@master ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:NetuQCC4DHoQPQEPDD5rGOpva3vMWMobhk9GFUnwpAM root@master
The key's randomart image is:
+---[RSA 2048]----+
|BE.+o+.          |
|++= =.o          |
|o*.= + .  o      |
|+.* o   .. o     |
|o+ .   .S .      |
|o o  .  ..       |
| o.=*    ..      |
|  **.+   ..      |
|  o*=    ..      |
+----[SHA256]-----+

# 2.上传对方服务器

代码语言:javascript
复制
[root@master ~]# ssh-copy-id 192.168.0.88
/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.88 (192.168.0.88)' can't be established.
ECDSA key fingerprint is SHA256:ZPLS5x78pbuuMIecl+HWHeDSkeG3aF6atbWZrvTSgyc.
ECDSA key fingerprint is MD5:fb:cd:88:c9:59:c9:c6:da:c5:32:15:5c:63:5f:ea:41.
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
root@192.168.0.88's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh '192.168.0.88'"
and check to make sure that only the key(s) you wanted were added.
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020-01-29,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • # 1.生成密钥私钥
  • # 2.上传对方服务器
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档