One-Time-Password로, 특정 알고리즘에 맞춰 일정 시간 마다 일회성 암호를 생성하여 사용자를 확인하는 인증방법 중하나이다. Google, Azure 등 다양한 곳에서 제공한다.
단순히 pem키나 비밀번호만으로 접속하게 될 경우 보안상 문제가 된다면 흔히 요즘 말하는 2단계 인증요소로 쓰일 수 있다. (2FA Two-Factor-Authentication)
apt install libpam-google-authenticator
PAM(Pluggable Authentication Modules) 설정파일에 Google Authenticator를 추가합니다.
vi /etc/pam.d/sshd로 접속해 아래 내용을 가장 하단에 추가합니다.
auth required pam_google_authenticator.so nullok
vi/etc/ssh/sshd_config
PasswordAuthentication no
ChallengeResponseAuthentication yes
UsePAM yes
PermitEmptyPasswords no
systemctl restart sshd