一般来说,使用ssh远程登陆服务器,只需要输入账号和密码,显然这种方式不是很安全。为了安全着想,可以使用GoohleAuthenticator(谷歌身份验证器),以便在账号和密码之间在增加一个验证码,只有输入正确的验证码之后,在输入密码才能登陆。这样就增强了ssh登陆的安全性。账号、验证码、密码三者缺一个都不能登陆,即使账号和密码正确,验证码错误,同样登陆失败。其中,验证码是动态验证码,并且是通过手机客户端自动获取(默认每隔30秒失效一次)
一、关闭SELINUX
[root@ localhost~]# vim /etc/selinux/config #永久关闭。需要reboot重启后生效
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@localhost ~]# setenforce 0
Linux SSH二次身份验证:Google Authenticator实战

本文记录了如何在Linux系统中通过Google Authenticator增强SSH登录安全性。通过设置,用户在输入账号和密码之外,还需要提供动态验证码才能成功登陆。动态验证码由手机客户端每30秒更新一次,确保了账号的安全。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



