栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Centos8配置ssh免密登录

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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.

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/395749.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号