linux ssh 对等性配置

简介: linux ssh 对等快速配置

os 版本

Red Hat Enterprise Linux Server release 6.8

配置环境

prod01 192.168.0.230
prod04 192.168.0.197

配置root 对等性

主要命令:ssh-keygen ,ssh-copy-id

配置过程

[root@prod01 ~]# ssh-keygen 
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:
08:36:39:c3:9a:92:c0:ea:a0:f3:8f:87:2f:79:9a:2c root@prod01
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|.  . .           |
|..  O            |
|o. + = .         |
|= o   . S        |
|+.               |
|o. o             |
|E++oo            |
| .*Bo            |
+-----------------+
[root@prod01 ~]# 
[root@prod01 ~]# 
[root@prod01 ~]# ssh-copy-id 192.168.0.230
The authenticity of host '192.168.0.230 (192.168.0.230)' can't be established.
RSA key fingerprint is a5:27:79:df:14:ab:fe:83:10:ad:59:14:b3:d2:ec:0d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.230' (RSA) to the list of known hosts.
root@192.168.0.230's password: 
Now try logging into the machine, with "ssh '192.168.0.230'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

[root@prod01 ~]# 
[root@prod01 ~]# scp -r ^C
[root@prod01 ~]# pwd
/root
[root@prod01 ~]# scp -r .ssh/ 192.168.0.197:/root/
The authenticity of host '192.168.0.197 (192.168.0.197)' can't be established.
RSA key fingerprint is ca:a4:56:1e:6d:4f:b1:5f:c0:e1:55:47:6d:9b:5b:22.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.197' (RSA) to the list of known hosts.
root@192.168.0.197's password: 
id_rsa.pub                                                                                                                 100%  393     0.4KB/s   00:00    
id_rsa                                                                                                                     100% 1679     1.6KB/s   00:00    
authorized_keys                                                                                                            100%  393     0.4KB/s   00:00    
known_hosts                                                                                                                100%  790     0.8KB/s   00:00    
[root@prod01 ~]# ssh 192.168.0.197 date
Wed Nov 28 09:36:28 CST 2018
[root@prod01 ~]# ssh 192.168.0.230 date
Wed Nov 28 09:36:32 CST 2018
[root@prod01 ~]# 

测试连通性

#PROD01 
[root@prod01 ~]# ssh 192.168.0.230 date
[root@prod01 ~]# ssh 192.168.0.230 date
Wed Nov 28 09:37:15 CST 2018
[root@prod01 ~]# ssh 192.168.0.197 date
Wed Nov 28 09:37:20 CST 2018
#PROD04 
[root@prod04 ~]# ssh 192.168.0.197 date
Wed Nov 28 09:38:01 CST 2018
[root@prod04 ~]# ssh 192.168.0.230 date
Wed Nov 28 09:38:04 CST 2018
[root@prod04 ~]# 
相关文章
|
11天前
|
消息中间件 安全 Unix
SSH配置多台服务器之间的免密登陆以及登陆别名
SSH配置多台服务器之间的免密登陆以及登陆别名
21 1
|
15天前
|
安全 Ubuntu Java
Linux配置使用篇
Linux配置使用篇
|
14天前
|
Linux 网络安全
linux免密登录报错 Bad owner or permissions on /etc/ssh/ssh_config.d/05-redhat.conf
linux免密登录报错 Bad owner or permissions on /etc/ssh/ssh_config.d/05-redhat.conf
23 1
|
14天前
|
网络协议 Linux
在Linux中,管理和配置网络接口
在Linux中管理网络接口涉及多个命令,如`ifconfig`(在新版本中被`ip`取代)、`ip`(用于网络设备配置)、`nmcli`(NetworkManager的CLI工具)、`nmtui`(文本界面配置)、`route/ip route`(处理路由表)、`netstat/ss`(显示网络状态)和`hostnamectl/systemctl`(主机名和服务管理)。这些命令帮助用户启动接口、设置IP地址、查看连接和路由信息。不同发行版可能有差异,建议参考相应文档。
19 4
|
1天前
|
Ubuntu 网络协议 Linux
Linux(20) Ubuntu 20.04 网络接口自动切换路由配置
Linux(20) Ubuntu 20.04 网络接口自动切换路由配置
12 0
|
1天前
|
Linux
Linux(9)Debain EC25 quectel-CM usbnet0开机自动联网配置
Linux(9)Debain EC25 quectel-CM usbnet0开机自动联网配置
6 0
|
4天前
|
网络协议 安全 Linux
IDEA通过内网穿透实现固定公网地址远程SSH连接本地Linux服务器
IDEA通过内网穿透实现固定公网地址远程SSH连接本地Linux服务器
|
4天前
|
Linux 网络安全 开发工具
【GitLab私有仓库】在Linux上用Gitlab搭建自己的私有库并配置cpolar内网穿透
【GitLab私有仓库】在Linux上用Gitlab搭建自己的私有库并配置cpolar内网穿透
|
4天前
|
缓存 安全 Ubuntu
Linux配置代理上网
如何配置Linux代理
12 1
|
6天前
|
网络协议 安全 Shell
配置ssh服务
配置ssh服务