CenOS7秘钥双向验证的配置
配置密钥对的双向配置
HOST1配置:
root下编辑/etc/ssh/sshd_config
RSAAuthentication yes //启用RSA算法
PubkeyAuthentication yes //启用秘钥对验证
[root@host1 ~]# useradd hadoop //建立一个用户
[root@host1 ~]# passwd hadoop //设置密码
更改用户 hadoop 的密码 。
新的 密码:
无效的密码: 密码少于 8 个字符
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
[root@host1 ~]# su - hadoop
上一次登录:五 8月 16 03:44:00 CST 2019pts/0 上
[hadoop@host1 ~]$ pwd
/home/hadoop
[hadoop@host1 ~]$ ssh-keygen -t rsa //生成密钥对,加密格式为rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hadoop/.ssh/id_rsa): //密钥路径
Created directory '/home/hadoop/.ssh'.
Enter passphrase (empty for no passphrase): //公钥密码,回车即设置空密码(回车)
Enter same passphrase again: //二次输入公钥密码(回车)
Your identification has been saved in /home/hadoop/.ssh/id_rsa.
Your public key has been saved in /home/hadoop/.ssh/id_rsa.pub.
The key fingerprint is:
77:05:b5:65:b7:b6:81:79:79:6d:2d:13:e2:73:65:4e hadoop@host1
The key's randomart image is:
+--[ RSA 2048]----+
| o.o E|
| . ooX*|
| oo***|
| +o++|
| S . . . |
| . . |
| |
| |
| |
+-----------------+
[hadoop@host1 ~]$ ssh-copy-id -i .ssh/id_rsa.pub hadoop@192.168.50.112 //将公钥传给位于host2下的hatoop
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
hadoop@192.168.50.112's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'hadoop@192.168.50.112'"
and check to make sure that only the key(s) you wanted were added.
[hadoop@host1 ~]$ ssh hadoop@192.168.50.112 //无需验证密码即可登录
Last login: Thu Aug 15 20:10:32 2019 from 192.168.50.111
[hadoop@host2 ~]$
HOST2配置:
root下编辑/etc/ssh/sshd_config
RSAAuthentication yes //启用RSA算法
PubkeyAuthentication yes //启用秘钥对验证
[hadoop@host2 ~]$ mkdir .ssh
[hadoop@host2 ~]$ chmod 700 .ssh/
[hadoop@host2 ~]$ ls -ld .ssh/
drwx------. 2 hadoop hadoop 6 8月 15 20:02 .ssh/
[hadoop@host2 ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hadoop/.ssh/id_rsa): //密钥路径
Enter passphrase (empty for no passphrase): //输入公钥密码,回车即空密码(回车)
Enter same passphrase again: //再次输入(回车)
Your identification has been saved in /home/hadoop/.ssh/id_rsa.
Your public key has been saved in /home/hadoop/.ssh/id_rsa.pub.
The key fingerprint is:
f3:37:cc:fa:98:d6:ed:79:db:b6:68:13:cf:21:5f:66 hadoop@host2
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| |
| |
| S |
| o o o .E|
| ..=.*oo|
| .=.+o=+|
| .+.oo+=+|
+-----------------+
[hadoop@host2 ~]$ ssh-copy-id -i .ssh/id_rsa.pub hadoop@192.168.50.111 //将公钥文件传给HOST1
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
hadoop@192.168.50.111's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'hadoop@192.168.50.111'"
and check to make sure that only the key(s) you wanted were added.
[hadoop@host2 ~]$ ssh hadoop@192.168.50.111 //直接登录,无需验证密码
Last login: Fri Aug 16 04:12:03 2019 from 192.168.50.112
[hadoop@host1 ~]$
CenOS7秘钥双向验证的配置的更多相关文章
- 构建秘钥对验证的SSH体系
构建秘钥对验证的SSH 体系 首先先要在ssh 客户端以root用户身份创建秘钥对 客户端将创建的公钥文件上传至ssh服务器 服务器将公钥信息导入用户root的公钥数据库文件 客户端以root用户身份 ...
- Git秘钥生成以及Gitlab配置
安装Git:详见http://www.cnblogs.com/xiuxingzhe/p/9300905.html 开通gitlab(开通需要咨询所在公司的gitlab管理员)账号后,本地Git仓库和g ...
- Git秘钥生成以及Gitlab配置(附以下问题解决方法:Key is invalid Fingerprint cannot be generated)
在进行Git密钥配置时,总是提示: “The form contains the following errors:Key is invalidFingerprint cannot be genera ...
- ssl/https双向验证的配置
1.SSL认证 不需要特别配置,相关证书库生成看https认证中的相关部分 2.HTTPS认证 一.基本概念 1.单向认证,就是传输的数据加密过了,但是不会校验客户端的来源 2.双向认证,如果客户端 ...
- ssl https双向验证的配置与证书库的生成
1.SSL认证 不须要特别配置,相关证书库生成看https认证中的相关部分 2.HTTPS认证 一.基本概念 1.单向认证,就是传输的数据加密过了,可是不会校验client的来源 2.双向认证,假设 ...
- nginx配置ssl双向验证 nginx https ssl证书配置
1.安装nginx 参考<nginx安装>:http://www.ttlsa.com/nginx/nginx-install-on-linux/ 如果你想在单IP/服务器上配置多个http ...
- Android中保存静态秘钥实践(转)
本文我们将讲解一个Android产品研发中可能会碰到的一个问题:如何在App中保存静态秘钥以及保证其安全性.许多的移动app需要在app端保存一些静态字符串常量,其可能是静态秘钥.第三方appId等. ...
- soapui测试https双向验证p12项目
1.准备好p12 和jsk秘钥文件 2.配置soapui ssl 其中: 1:jks就是放在trustStore那里,密码填写为 106075 2:p12放到keystore,密码填写:180000 ...
- git生成SSH秘钥
1.进入git bash , 输入 cd ~/.ssh/ ,没有的话,自己创建 mkdir ~/.ssh , 然后进入该文件夹完成生成秘钥步骤 2.配置全局的name和email,这里是的你githu ...
随机推荐
- 把java项目打包成jar包并可以直接运行【我】
首先创建一个maven的jar项目,然后代码写好后,在项目右键,导出: 选择java下面的可运行的jar文件: 下一步: 要注意的是: launch configuration 此选项是指定选中要导出 ...
- [笔记] Delphi使用DUnitX做单元测试的简单例子
Delphi XE 提供了对DUnitX的支持,记录一个最简例子. 首先创建项目A,然后创建单元untCalc,代码如下: unit untCalc; interface type TCalc = c ...
- Swift基础知识点的学习
每一个程序员都有一颗不满足当下知识的学习,学习Swift更是每一个iOS程序员必学技能!!! 一说道基础点的学习,当然涵盖的方面也是很多很多啦....然而每一个小知识点的学习,写一个博客,我也觉得没什 ...
- 【经验分享】Mongodb操作类实现CRUD
一.背景 公司项目中在做数据存储时使用到Mongodb,所以想着将Mongodb的操作封装后可供项目中其他成员方便使用. 附上Mongodb的下载地址: 下载 1.Mongodb类 此类主要是用来构造 ...
- 组件推荐Forloop.HtmlHelpers 用来实现MVC的js加载顺序
最近在开发的时候遇到js加载顺序的问题,layui在底部声明了js,但是我想在页面其他地方使用分布视图,分布视图内有自己的js逻辑,发现不能执行,一看就发现,这里的js应该加在layui后面执行才能有 ...
- Linux (Ubuntu 18.04) 安装vim编辑器
大家可以去Ubuntu官网下载桌面系统:https://ubuntu.com/download/desktop,虽然最新版是19.04,但是建议大家下载稳定版18.04.安装过程非常简洁,我使用的是V ...
- JS创建对象的四种简单方式 (工厂模式和自定义构造函数创建对象的区别)
// 对象:特指的某个事物,具有属性和方法(一组无序的属性的集合) // 特征------>属性 // 行为------>方法 // 创建对象的四种方式 1 // 1.字面量的方式,就是实 ...
- 【Python开发】python重命名文件和遍历文件夹操作
当前文件夹下,把所有文件名中的"50076"替换成"50092",用Python实现,代码所下: # encoding: utf-8 import os imp ...
- Source 介绍
!!!1.Avro Source 监听AVRO端口来接受来自外部AVRO客户端的事件流. 利用Avro Source可以实现多级流动.扇出流.扇入流等效果. 另外也可以接受通过flume提供的Avro ...
- PHP Smarty模板的安装
最近开发中用到了PHP中smarty模板..作为一个长久以来的前端,开始学习PHP模板..下面将安装教程分享给大家.. 1. 下载Smarty最新版: http://www.smarty.NET/do ...