linux系统配置二次登录
centos系统
安装动态口令
yum install google-authenticator -y
yum -y install mercurial pam-devel
google-authenticator
#出现这个二维码的时候使用动态口令app扫描下


修改用户配置
vim /etc/pam.d/sshd
auth required pam_google_authenticator.so
vim /etc/ssh/sshd_config
ChallengeResponseAuthentication yes


重启ssh,登录测试





动态口令输入3次用户锁定30秒
其它用户配置
只要用户设置了二次认证,其它用户也要设置下,不然登录不上去。
可以把


ubuntu系统安装
安装
apt-get install libpam-google-authenticator
google-authenticator
出现二维码后,先扫描。然后输入动态口令



修改ssh
vim /etc/pam.d/sshd
auth required pam_google_authenticator.so
vim /etc/ssh/sshd_config


登录方式和centos一样
取消二次登录
#这两个配置文件添加的配置删除,重启sshd服务,如果登录不上系统,进入单用户密码修改
vim /etc/pam.d/sshd
vim /etc/ssh/sshd_config

浙公网安备 33010602011771号