centos7系统配置系统用户基于ssh的google身份验证
最近也是服务器各种被入侵,所以在安全上,要万分注意,特此记录,借助google的身份验证插件,获取动态验证码完成ssh登陆。
OS:
centos7
安装配置:
1、 安装epel源
yum -y install epel-release
2、 安装Qrencode,谷歌身份验证器通过该程序生成二维码
yum install -y qrencode
3、安装谷歌身份验证器,编译安装
git clone https://github.com/google/google-authenticator-libpam.git
cd google-authenticator-libpam/
./bootstrap.sh
./configure –prefix=/usr/local/google-authenticator
make && make install
4、拷贝google的身份验证器pam模块到系统下
cp /usr/local/google-authenticator/lib/security/pam_google_authenticator.so /lib64/security/
5、配置sshd的pam认证,写在auth include password-auth 基于密码认证的上面一行,先基于google验证码认证
auth required pam_google_authenticator.so
6、修改ssh服务配置
ChallengeResponseAuthentication yes
7、 重启ssh服务
systemctl restart sshd
8、进入刚才克隆下来的 google-authenticator-libpam 目录,执行
./google-authenticator #基于当前用户做验证,如果切换别的系统用户,请登陆其他用户,执行此命令即可
Do you want authentication tokens to be time-based (y/n) y #输入y, 提示是否基于时间的认证
接下来会生成一张二维码图片: 手机上下载身份验证器app软件,扫描此二维码

Your new secret key is: JS57SLVUDEEA7SQ7LD6BEBWGAA #此安全key需要备份,用于后续更换手机或者二维码丢失,浏览器的身份验证丢失后,通过此安全key获取新的验证吗 Your verification code is 005421 #扫描上述二维码后,查看验证吗,输入
Your emergency scratch codes are:
# 以下验证吗,是后续备用的,只能验证一次
45412365
21522365
85124632
85124631
14785216 Do you want me to update your “/root/.google_authenticator” file (y/n) y Do you want to disallow multiple uses of the same authentication
token? This restricts you to one login about every 30s, but it increases
your chances to notice or even prevent man-in-the-middle attacks (y/n) Do you want to disallow multiple uses of the same authentication
token? This restricts you to one login about every 30s, but it increases
your chances to notice or even prevent man-in-the-middle attacks (y/n) y By default, tokens are good for 30 seconds. In order to compensate for
possible time-skew between the client and the server, we allow an extra
token before and after the current time. If you experience problems with
poor time synchronization, you can increase the window from its default
size of +-1min (window size of 3) to about +-4min (window size of
17 acceptable tokens).
Do you want to do so? (y/n) y
# 安全相关,默认继续 If the computer that you are logging into isn’t hardened against brute-force
login attempts, you can enable rate-limiting for the authentication module.
By default, this limits attackers to no more than 3 login attempts every 30s.
Do you want to enable rate-limiting (y/n) y
# 安全相关,默认继续
9、xshell终端配置基于google验证登陆linux主机
xshell终端的连接方式改为:keyboard Interactive

二次验证码输入:

输入系统密码:

以上就是基于google身份验证的ssh登陆。
centos7系统配置系统用户基于ssh的google身份验证的更多相关文章
- linux上使用google身份验证器(简版)
系统:centos6.6 下载google身份验证包google-authenticator-master(其实只是一个.zip文件,在windwos下解压,然后传进linux) #cd /data/ ...
- centos 6 SSH配置Google Authentication 验证
创建工作目录: mkdir google-authentication 1. 安装二维码生成依赖 #wget http://fukuchi.org/works/qrencode/qrencode-3. ...
- 通过Google身份验证器加强Linux帐户安全
下载Google的身份验证模块: # wget https://google-authenticator.googlecode.com/files/libpam-google-authenticato ...
- Nginx集群之基于Redis的WebApi身份验证
目录 1 大概思路... 1 2 Nginx集群之基于Redis的WebApi身份验证... 1 3 Redis数据库... 2 4 Visualbox ...
- 两步验证杀手锏:Java 接入 Google 身份验证器实战
两步验证 大家应该对两步验证都熟悉吧?如苹果有自带的两步验证策略,防止用户账号密码被盗而锁定手机进行敲诈,这种例子屡见不鲜,所以苹果都建议大家开启两步验证的. Google 的身份验证器一般也是用于登 ...
- Win10系统进行远程桌面连接出现身份验证错误怎么办
在win10系统中,自带有远程桌面连接功能,但是有时候会遇到一些问题,比如有不少用户反映说在进行远程桌面连接的时候,出现身份验证错误的情况,导致远程连接失败,接下来给大家分享一下Win10系统进行远程 ...
- 在ASP.NET Web API 2中使用Owin基于Token令牌的身份验证
基于令牌的身份验证 基于令牌的身份验证主要区别于以前常用的常用的基于cookie的身份验证,基于cookie的身份验证在B/S架构中使用比较多,但是在Web Api中因其特殊性,基于cookie的身份 ...
- 使用google身份验证器实现动态口令验证
最近有用户反应我们现有的短信+邮件验证,不安全及短信条数限制和邮件收验证码比较慢的问题,希望我们 也能做一个类似银行动态口令的验证方式.经过对可行性的分析及慎重考虑,可以实现一个这样的功能. 怎么实现 ...
- 基于JWT的Token身份验证
身份验证,是指通过一定的手段,完成对用户身份的确认.为了及时的识别发送请求的用户身份,我们调研了常见的几种认证方式,cookie.session和token. 1.Cookie cookie是 ...
随机推荐
- C++禁止使用拷贝构造函数和赋值运算符方法
1.将拷贝构造函数和赋值运算符声明为私有,并不予实现 class Uncopyable { private: Uncopyable(const Uncopyable &); // 阻止copy ...
- 22、整合mybatis
搭建环境: 1).创建工程需要的maven坐标 这个mybatis的starter是mybatis官方出的适应springboot 2).数据连接池的使用 引入Druid数据连接池 <depen ...
- C++Builder编写计算器
用C++Builder确实能快速上手, 只要是会一点C++基础的,都能很快的编写一些小程序,而且VCL库组件也很丰富,比微软MFC强多了. 自己动手写了一个计算器来增加自己的兴趣.C++基础以后有空还 ...
- Hibernate之CRUD实践
Hibernate作为一个高度封装的持久层框架,曾经是非常牛逼的,现在虽然应用不是特别广,比如我前公司主要是做OA的,应用的框架就是Spring+SpringMVC+Hibernate. Hibern ...
- 安装JDK8
安装JDK8 1.去http://www.Oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html中下载JDK的 ...
- CVPR 2016 paper reading (3)
DeepFashion: Powering Robust Clothes Recognition and Retrieval with Rich Annotations, Ziwei Liu, Pin ...
- RHEL6(RedHat6)和SUSE11系统配置IPV6地址
临时生效 RHEL6和SUSE11系统临时配置IPv6地址操作是一样的,比如添加如下ipv6地址. ip - addr add ::A/ dev eth2 ip - route add default ...
- CentOS6.5 虚拟机 磁盘扩容
1. 关闭虚拟机 2. 编辑虚拟机设置:增加硬盘的置备大小,或者添加新的硬盘 3. 启动虚拟机,查看可用磁盘大小 : # df -Th Filesystem Type Size Used Avail ...
- Elasticsearch 数据操作
一.新增数据 1.1 随机生成id 语法: POST /索引库名/类型名 { "key1": "value1", "key2": " ...
- [转]去掉IOS下的input 和textarea的内阴影
在IOS下,input 和textarea表单默认会有个内阴影,一定程度上影响视觉一致,可通过设置下面代码去掉: input{-webkit-appearance: none;}