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 ~]# 
相关文章
|
Linux 网络安全 Docker
盘古栈云,创建带ssh服务的linux容器
创建带ssh服务的linux容器
653 146
|
Ubuntu Linux 网络安全
Linux服务器之Ubuntu的安装与配置
Ubuntu Desktop是目前最成功、最流行的图形界面的Linux发行版;而Ubuntu Server也在服务器端市场占据了较大的份额。今天为大家详细介绍了Ubuntu Server的安装与配置,希望对你能有所帮助。关于VMware、VirtualBox等虚拟化软件的使用,朱哥还会在后续的文章中为大家详细介绍,敬请关注!
|
存储 Linux 开发工具
Linux环境下使用Buildroot配置软件包
使用Buildroot可以大大简化嵌入式Linux系统的开发和维护工作,但它需要对Linux系统和交叉编译有深入的理解。通过上述步骤,可以有效地配置和定制软件包,为特定的嵌入式应用构建高效、稳定的系统。
1491 11
|
网络安全 开发工具 git
配置本地环境以管理Git多账户SSH连接的方法
通过以上步駟设置后, 您可以轻松管理多個 Git 账户并且根据不同项目需求切换 SSH 密匙进行版本控制操作。
1690 20
|
Ubuntu Linux 网络安全
在Linux云服务器上限制特定IP进行SSH远程连接的设置
温馨提示,修改iptables规则时要格外小心,否则可能导致无法远程访问你的服务器。最好在掌握足够技术知识和理解清楚操作含义之后再进行。另外,在已经配置了防火墙的情况下,例如ufw(Ubuntu Firewall)或firewalld,需要按照相应的防火墙的规则来设置。
974 24
|
关系型数据库 MySQL Java
安装和配置JDK、Tomcat、MySQL环境,以及如何在Linux下更改后端端口。
遵循这些步骤,你可以顺利完成JDK、Tomcat、MySQL环境的安装和配置,并在Linux下更改后端端口。祝你顺利!
941 11
|
Kubernetes Linux 网络安全
Rocky Linux 8.9配置Kubernetes集群详解,适用于CentOS环境
初始化成功后,记录下显示的 `kubeadm join`命令。
1037 0
|
监控 Linux 网络安全
FinalShell SSH工具下载,服务器管理,远程桌面加速软件,支持Windows,macOS,Linux
FinalShell是一款国人开发的多平台SSH客户端工具,支持Windows、Mac OS X和Linux系统。它提供一体化服务器管理功能,支持shell和sftp同屏显示,命令自动提示,操作便捷。软件还具备加速功能,提升访问服务器速度,适合普通用户和专业人士使用。
4807 0
|
网络安全 开发工具 git
GitHub 多账户 SSH 配置指南
本文介绍了如何在同一台电脑上配置多个 GitHub 账户的 SSH 密钥。内容包括:检查现有密钥、生成新的 SSH 密钥、配置 SSH config 文件、将公钥添加到 GitHub、验证 SSH 连接、设置 Git 用户信息、创建工作区目录、使用不同账户克隆仓库,以及为每个仓库配置独立的用户信息等步骤。通过这些操作,可以实现在不同项目中使用不同的 GitHub 账户进行提交和管理。
1080 0
|
安全 Linux 网络安全
在Linux(CentOS和AWS)上安装更新的git2的方法并配置github-ssh
经过以上这些步骤,你现在就能在GitHub上顺利往返,如同海洋中的航海者自由驰骋。欢迎你加入码农的世界,享受这编程的乐趣吧!
761 10