一:準備一臺linux 操作系統
在Ubuntu上安裝Google身份驗證器
sudo apt-get install libpam-google-authenticator -y
在centos上安裝Google身份驗證器
#安裝eplel庫
sudo yum install epel-release -y
#安裝google-authenticator
sudo yum install -y google-authenticator
二:在liunx上切換到需要用到雙重登錄的賬號上執行
google-authenticator
執行時會問一下問題,可以一直按y即可(此二維碼要保存好,萬不可丟失)
三:爲ssh配置Google身份驗證器
### 1.修改PAM配置文件
$ sudo vim /etc/pam.d/sshd
# Disallow non-root logins when /etc/nologin exists.
account required pam_nologin.so
# 添加這一行
auth required pam_google_authenticator.so
### 2.在SSH配置文件裏啓用 ChallengeResponseAuthentication
$ sudo vim /etc/ssh/sshd_config
ChallengeResponseAuthentication yes
### 3.重啓SSH服務
$ sudo service ssh restart
四:在安卓應用市場搜索並安裝Google身份驗證器並下載
Authenticator
用+裏的掃條形碼掃上面的二維碼添加到app中動態碼即可
到此。ssh雙重登錄驗證完成
內容參考至百度文檔