.
.
.
UPSET
sudo -u user -H mkdir -p /home/user/.ssh
sudo -u user -H google-authenticator \
-t -d -f -r 3 -R 30 -w 3 \
--secret=/home/user/.ssh/google_authenticator
sudo chown user:user /home/user/.ssh/google_authenticator
sudo chmod 400 /home/user/.ssh/google_authenticator
# .ssh 디렉터리와 내부 파일을 정책 기본값으로 라벨링
sudo restorecon -Rv /home/user/.ssh
# 확인
ls -Zd /home/user/.ssh
ls -Z /home/user/.ssh/google_authenticator
# 둘 다 타입이 ssh_home_t 여야 함
sudo vi /etc/pam.d/sshd
auth required pam_google_authenticator.so nullok secret=${HOME}/.ssh/google_authenticator
sudo vi /etc/ssh/sshd_config
UsePAM yes
PasswordAuthentication yes
ChallengeResponseAuthentication yes
<optional?>
UsePAM yes
KbdInteractiveAuthentication yes
AuthenticationMethods keyboard-interactive
sudo systemctl restart sshd
sudo sed -i 's/ secret=.* nullok/ secret=\/home\/shyim\/\.ssh\/google_authenticator/' /etc/pam.d/sshd
sudo systemctl restart sshd