ssh密匙互信操作【原创】
1、简便ssh密匙信任方法
只在一台服务器上创建ssh-keygen
[root@SMSJKSRVBJ02 ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
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:
da:::ed::::8b::e6::ea:ab::bc:5f root@SMSJKSRVBJ02
The key's randomart image is:
+--[ RSA ]----+
|oo o. |
|*. o o |
|..o . . |
|. o o |
| . . * S |
| .. = + |
| .+ . E . |
|.o . . . |
|. ... |
+-----------------+ [root@SMSJKSRVBJ02 ~]# cd .ssh/ [root@SMSJKSRVBJ02 .ssh]# ll -thr
total 12K
-rw-r--r-- root root Mar : known_hosts
-rw-r--r-- root root Mar : id_rsa.pub
-rw------- root root .7K Mar : id_rsa [root@SMSJKSRVBJ02 .ssh]# cat id_rsa.pub >> authorized_keys
将密匙传到别的服务器
[root@SMSJKSRVBJ02 .ssh]# scp * root@10.70.69.153:~/.ssh/
[root@SMSJKSRVBJ02 .ssh]# scp * root@10.70.69.152:~/.ssh/
[root@SMSJKSRVBJ02 .ssh]# scp * root@10.70.69.151:~/.ssh/
如果报错,
[root@SMSJKSRVBJ02 .ssh]# scp * root@10.70.69.152:~/.ssh/
The authenticity of host '10.70.69.152 (10.70.69.152)' can't be established.
RSA key fingerprint is :::::::ad:da:aa:2f:9f:2c:8a:ea:.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.70.69.152' (RSA) to the list of known hosts.
root@10.70.69.152's password:
scp: /root/.ssh/: No such file or directory
说明对方没有ssh-keygen生成.ssh目录,去登陆服务器执行ssh-keygen
因为使用密匙相同,这4台服务器之间就互相信任可以互相访问了。
2、标准的方法
配置SSH登录无密码验证(使用key登录,工作中常用,最好不要禁掉密码登录,如果禁了,可能会有问题)
在server02 192.168..131操作(Monitor): 192.168.2.131 [root ~]$ ssh-keygen -t rsa
192.168.2.131 [root ~]$ ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.2.128
192.168.2.131 [root ~]$ ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.2.129
192.168.2.131 [root ~]$ ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.2.130 在server02 192.168..128操作(Master): 192.168.2.128 [root ~]$ ssh-keygen -t rsa
192.168.2.128 [root ~]$ ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.2.129
192.168.2.128 [root ~]$ ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.2.130 在server03 192.168..129操作(slave): 192.168.2.129 [root ~]$ ssh-keygen -t rsa
192.168.2.129 [root ~]$ ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.2.128
192.168.2.129 [root ~]$ ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.2.130 在server04 192.168..130操作(slave):
192.168.2.130 [root ~]$ ssh-keygen -t rsa
192.168.2.130 [root ~]$ ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.2.128
192.168.2.130 [root ~]$ ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.2.129
欢迎转载,请注明出处!
ssh密匙互信操作【原创】的更多相关文章
- 实现liunx之间无密码访问——ssh密匙
环境描述 两台linux服务器 172.16.1.22[client],172.16.1.33[server],想要实现client服务器ssh无密码访问server服务器. 使用技术 linux 的 ...
- 多节点ssh免密匙登录
1,在所有节点上,使用yourname用户名执行: ssh-keygen -t dsa -P '' -f /home/yourname/.ssh/id_dsa 2,在node1的/home/yourn ...
- ssh自动分发密匙脚本样板
#!/bin/bash rom=/media/cdrom dir=/etc/yum.repos.d Use=$ mima=$ function yumj(){ [ -d "$rom" ...
- [JZOJ5897]密匙--哈希骚操作
[JZOJ5897]密匙--哈希骚操作 题目链接 太懒了自行Google 前置技能 二分/倍增求LCP e.g TJOI2017DNA 分析 这题看了样例解释才知道什么意思 本以为自己身为mo法师蛤希 ...
- Ubu18远程登录密匙设置
Ubu18设置远程密匙登录 相关文件 /etc/ssh/sshd_config 注意vscode使用博客园插件需要进行端口转发,在vscode端口处设置41385 本地生成密匙,任选一种,这里只介绍第 ...
- ssh 私匙登录, 文件rswrst权限
skill -KILL -u user1 //注销用户 ssh 免密码登录 http://flysnowxf.iteye.com/blog/1567570 (说是防火墙的问题) http://fly ...
- Linux学习(四)单用户模式、救援模式、虚拟机克隆、linux互连(包括密匙登录)
一.单用户模式 忘记root密码后,找回密码有两种方法: 单用户(grub没有加密的情况下可以使用) 救援模式 这一节我们先讲单用户模式 1.先重启(3种方法) reboot init 6 sho ...
- Linux学习(三)putty,xshell使用以及密匙登陆
一.认识xshell,putty 他们都是服务器登陆客户端.xshell用户体验更好一点.但这里都学一下. putty下载地址:https://www.chiark.greenend.org.uk/~ ...
- TortoiseGit + msysgit 记住帐号密码方法及使用密匙的方法
Windows 重度用户只能用 for windows 的软件了,所以虽然使用 Git,但还是要找专门的 windows 版本. 最近开始使用 GitHub 来托管一些小项目/兴趣,而自己是重度 wi ...
随机推荐
- 【RMAN】RMAN脚本中使用替换变量
[RMAN]RMAN脚本中使用替换变量--windows 下rman全备脚本 一.1 BLOG文档结构图 一.2 前言部分 一.2.1 导读 各位技术爱好者,看完本文后,你可以掌握如下的技能,也 ...
- java web添加spring jar 包
maven依赖: <properties> <spring.version>5.1.7.RELEASE</spring.version> </properti ...
- VMware 设置虚拟机Centos 上网的两种方式
能在VMware上面安装虚拟机,不可能说是不让链接外网,只是在自己电脑上玩玩就可以了.因为学习需要,经常在自己笔记本上面搭建虚拟机,我经常使用的两种上网方式 一 NET方式上网 设置VMware Ne ...
- FreeBSD关机后自动重启的解决办法
我用的是华硕的笔记本电脑,不知道别的电脑有没有这个情况,按handbook关机指令为shutdown -p now,但是我执行这个指令后电脑却自动重启,用Linux关机指令shutdown -h no ...
- oracle 字符串分隔去重函数
create or replaceFUNCTION "SF_SPLIT_ACCOUNT_ID_LIST" ( account_id_list IN VARCHAR2)RETURN ...
- 使用flask搭建微信公众号:接收与回复消息
token验证的意义 在看了别人的代码之后对token加密有了些理解了.但又觉得很鸡肋.第一次验证服务器的时候我在那弄了半天的验证其实不写也可以验证成功,只要直接返回echostr这个字段就行了.微信 ...
- sqlserver2005新特性介绍
1.更强的编程能力-CLR集成 增强了数据库的编程能力,将一些逻辑层(Bll)转移到数据库中,减少了网络中的数据流量,但是增加了服务器cpu的负荷,当我们需要操作大量的数据,但是产生很少的数据,把这种 ...
- 做阉割版Salesforce难成伟大的TOB企业
https://www.lieyunwang.com/archives/446227 猎云注:当前中国市场环境下,有没有可能诞生一批SaaS级企业服务公司?东方富海合伙人陈利伟用三个方面基础性问题解答 ...
- Net-NTLMv1的利用思路
Net-NTLMv1的加密方法: 客户端向服务器发送一个请求 服务器接收到请求后,生成一个16位的Challenge,发送回客户端 客户端接收到Challenge后,使用登录用户的密码hash对Cha ...
- [Ignatius and the Princess III] 整数的无序拆分(DP + 生成函数)
整数的有序拆分就是隔板法,无序拆分则有两种处理方法 DP递推 我们假设P(n,m)P(n,m)P(n,m)是正整数nnn无序拆分为mmm个正整数的方案数 对于某一种拆分,不妨将拆分出来的mmm个数从小 ...