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密匙互信操作【原创】的更多相关文章

  1. 实现liunx之间无密码访问——ssh密匙

    环境描述 两台linux服务器 172.16.1.22[client],172.16.1.33[server],想要实现client服务器ssh无密码访问server服务器. 使用技术 linux 的 ...

  2. 多节点ssh免密匙登录

    1,在所有节点上,使用yourname用户名执行: ssh-keygen -t dsa -P '' -f /home/yourname/.ssh/id_dsa 2,在node1的/home/yourn ...

  3. ssh自动分发密匙脚本样板

    #!/bin/bash rom=/media/cdrom dir=/etc/yum.repos.d Use=$ mima=$ function yumj(){ [ -d "$rom" ...

  4. [JZOJ5897]密匙--哈希骚操作

    [JZOJ5897]密匙--哈希骚操作 题目链接 太懒了自行Google 前置技能 二分/倍增求LCP e.g TJOI2017DNA 分析 这题看了样例解释才知道什么意思 本以为自己身为mo法师蛤希 ...

  5. Ubu18远程登录密匙设置

    Ubu18设置远程密匙登录 相关文件 /etc/ssh/sshd_config 注意vscode使用博客园插件需要进行端口转发,在vscode端口处设置41385 本地生成密匙,任选一种,这里只介绍第 ...

  6. ssh 私匙登录, 文件rswrst权限

    skill -KILL -u user1  //注销用户 ssh 免密码登录 http://flysnowxf.iteye.com/blog/1567570 (说是防火墙的问题) http://fly ...

  7. Linux学习(四)单用户模式、救援模式、虚拟机克隆、linux互连(包括密匙登录)

    一.单用户模式 忘记root密码后,找回密码有两种方法: 单用户(grub没有加密的情况下可以使用) 救援模式 这一节我们先讲单用户模式   1.先重启(3种方法) reboot init 6 sho ...

  8. Linux学习(三)putty,xshell使用以及密匙登陆

    一.认识xshell,putty 他们都是服务器登陆客户端.xshell用户体验更好一点.但这里都学一下. putty下载地址:https://www.chiark.greenend.org.uk/~ ...

  9. TortoiseGit + msysgit 记住帐号密码方法及使用密匙的方法

    Windows 重度用户只能用 for windows 的软件了,所以虽然使用 Git,但还是要找专门的 windows 版本. 最近开始使用 GitHub 来托管一些小项目/兴趣,而自己是重度 wi ...

随机推荐

  1. ipc$ 空连接 net use

    常用命令 [xxx]表示的内容,需要根据自己的需求更改 //建立空连接 > net use \\127.0.0.1\ipc$ //删除连接 > net use \\127.0.0.1\ip ...

  2. Celery:Optimizing

    参考文档:http://docs.celeryproject.org/en/latest/userguide/optimizing.html#guide-optimizing

  3. Implement CGLIB in ABAP

    What is cglib?A Byte Code Generation Library which is high level API to generate and transform Java ...

  4. 《我是一只IT小小鸟》(续)读书笔记——第八周

    第三位作者强调了大学阶段规划的重要性,作者初入大学,一切都很新鲜想尝试,却缺乏对学习生活的规划.最终导致的是学习成绩的下降.其实编程也是一样,我们常常感到自己和那些大神的差距,感慨过后,往往也就罢了. ...

  5. 树莓派安装系统+ssh登录

    一.准备工作: (1)树莓派3b (2)官网下载系统 (3)SD卡 (4)网线 (5)SDFormatter.exe (6)win32diskimager.exe (7)putty (7)笔记本 二. ...

  6. ElasticSearch(十二):Spring Data ElasticSearch 的使用(二)

    在前一篇博文中,创建了Spring Data Elasticsearch工程,并且进行了简单的测试,此处对Spring Data Elasticsearch进行增删改查的操作. 1.增加 在之前工程的 ...

  7. 今天看了《SOFT SKILLS The Software Developer's Life Manual》有感

    从第四篇生产力开始看的,书中提到了专注,待续

  8. C# 验证控件组

    C# 验证控件允许使用ValidationGroup给验证控件分组,分组后的两组验证控件可以独立使用,互不相干.比如一个页面有登录和注册两个部分,假如使用验证控件组,提交的时候会对所有的验证控件进行验 ...

  9. Python 进程共享数据(数据传输)实例

    #coding:utf-8 ''' Created on 2017年11月22日 @author: li.liu ''' import multiprocessing from time import ...

  10. 从输入URL到页面返回的过程详解

    文章转自以为大神的博客;https://www.cnblogs.com/xianyulaodi/p/6547807.html#_labelTop 总结的很不错,看完收获颇多, 下面就是大神的文章,我只 ...