ubuntu 18.04 ssh 登录添加 Google Authenticator 两步验证

栏目: 服务器 · 发布时间: 6年前

内容简介:转载自安装 Google Authenticator安装完成之后修改文件

转载自 雨中看海

安装 Google Authenticator

sudo apt install libpam-google-authenticator

如果安装过程中报错,尝试添加源

sudo add-apt-repository universe

命令执行完成之后再次安装。

安装完成之后修改文件 /etc/pam.d/sshd ,在此文件末尾添加:

auth required pam_google_authenticator.so

如果你希望没有开启两部验证的账号还可以登录,则在此文件后面添加

auth required pam_google_authenticator.so nullok

接下来修改ssh配置文件 /etc/ssh/sshd ,修改

ChallengeResponseAuthentication no

ChallengeResponseAuthentication yes

重启sshd服务

sudo systemctl restart sshd.service

接下来我们就可以通过

google-authenticator

来生成一个二维码和密匙,全部选择yes,如下图

ubuntu 18.04 ssh 登录添加 Google Authenticator 两步验证

通过扫描二维码或者输入密匙添加到 Google Authenticator App,接下来登录时在输入密码的同时还需要输入谷歌验证中的验证码,如下图:

ubuntu 18.04 ssh 登录添加 Google Authenticator 两步验证

到这里Google Authenticator就配置成功了。


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Algorithms Sequential & Parallel

Algorithms Sequential & Parallel

Russ Miller、Laurence Boxer / Charles River Media / 2005-08-03 / USD 59.95

With multi-core processors replacing traditional processors and the movement to multiprocessor workstations and servers, parallel computing has moved from a specialty area to the core of computer scie......一起来看看 《Algorithms Sequential & Parallel》 这本书的介绍吧!

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试