Centos8配置ssh免密登录

[root@node-etl-01 ~]# yum -y install openssh-clients
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 10:22:29 ago on Mon Nov  1 09:17:41 2021.
Package openssh-clients-8.0p1-5.el8.x86_64 is already installed.
Dependencies resolved.
=====================================================================================================================================================
 Package                                 Architecture                   Version                                 Repository                      Size
=====================================================================================================================================================
Upgrading:
 openssh                                 x86_64                         8.0p1-6.el8_4.2                         baseos                         521 k
 openssh-clients                         x86_64                         8.0p1-6.el8_4.2                         baseos                         667 k
 openssh-server                          x86_64                         8.0p1-6.el8_4.2                         baseos                         484 k

Transaction Summary
=====================================================================================================================================================
Upgrade  3 Packages

Total download size: 1.6 M
Downloading Packages:
(1/3): openssh-server-8.0p1-6.el8_4.2.x86_64.rpm                                                                     623 kB/s | 484 kB     00:00    
(2/3): openssh-8.0p1-6.el8_4.2.x86_64.rpm                                                                            554 kB/s | 521 kB     00:00    
(3/3): openssh-clients-8.0p1-6.el8_4.2.x86_64.rpm                                                                    643 kB/s | 667 kB     00:01    
-----------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                1.1 MB/s | 1.6 MB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                             1/1 
  Running scriptlet: openssh-8.0p1-6.el8_4.2.x86_64                                                                                              1/1 
  Running scriptlet: openssh-8.0p1-6.el8_4.2.x86_64                                                                                              1/6 
  Upgrading        : openssh-8.0p1-6.el8_4.2.x86_64                                                                                              1/6 
  Upgrading        : openssh-clients-8.0p1-6.el8_4.2.x86_64                                                                                      2/6 
  Running scriptlet: openssh-server-8.0p1-6.el8_4.2.x86_64                                                                                       3/6 
  Upgrading        : openssh-server-8.0p1-6.el8_4.2.x86_64                                                                                       3/6 
  Running scriptlet: openssh-server-8.0p1-6.el8_4.2.x86_64                                                                                       3/6 
  Running scriptlet: openssh-server-8.0p1-5.el8.x86_64                                                                                           4/6 
  Cleanup          : openssh-server-8.0p1-5.el8.x86_64                                                                                           4/6 
  Running scriptlet: openssh-server-8.0p1-5.el8.x86_64                                                                                           4/6 
  Cleanup          : openssh-clients-8.0p1-5.el8.x86_64                                                                                          5/6 
  Cleanup          : openssh-8.0p1-5.el8.x86_64                                                                                                  6/6 
  Running scriptlet: openssh-8.0p1-5.el8.x86_64                                                                                                  6/6 
  Verifying        : openssh-8.0p1-6.el8_4.2.x86_64                                                                                              1/6 
  Verifying        : openssh-8.0p1-5.el8.x86_64                                                                                                  2/6 
  Verifying        : openssh-clients-8.0p1-6.el8_4.2.x86_64                                                                                      3/6 
  Verifying        : openssh-clients-8.0p1-5.el8.x86_64                                                                                          4/6 
  Verifying        : openssh-server-8.0p1-6.el8_4.2.x86_64                                                                                       5/6 
  Verifying        : openssh-server-8.0p1-5.el8.x86_64                                                                                           6/6 

Upgraded:
  openssh-8.0p1-6.el8_4.2.x86_64              openssh-clients-8.0p1-6.el8_4.2.x86_64              openssh-server-8.0p1-6.el8_4.2.x86_64             

Complete!
[root@node-etl-01 ~]# cat >> /etc/hosts << EOF
> 192.168.32.128 node-etl-01
> 192.168.32.129 node-etl-02
> 192.168.32.130 node-etl-03
> EOF
[root@node-etl-01 ~]# ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
Generating public/private rsa key pair.
Created directory '/root/.ssh'.
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:lmqUjeCUf26KcxIosHbIaGKygMq7YNE3MCt+QXWz0lU root@node-etl-01
The key's randomart image is:
+---[RSA 3072]----+
|     . o ..E     |
|    ..o +        |
|   ++. o         |
|. oo+o.+ .       |
|=+.=.o= S        |
|X*+.+..=         |
|@=.. .o o        |
|=.. oo.o         |
| oo .+.          |
+----[SHA256]-----+
[root@node-etl-01 ~]# ssh-copy-id node-etl-01
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node-etl-01 (192.168.32.128)' can't be established.
ECDSA key fingerprint is SHA256:SITNrVHcy8RA9PwQZvziwSmsR8X1y7TRyz3sAcXtD9w.
Are you sure you want to continue connecting (yes/no/[fingerprint])? 
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
The authenticity of host 'node-etl-01 (192.168.32.128)' can't be established.
ECDSA key fingerprint is SHA256:SITNrVHcy8RA9PwQZvziwSmsR8X1y7TRyz3sAcXtD9w.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/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@node-etl-01's password: 

Number of key(s) added: 1

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值