SW/서버보안
Centos7 - OTP 설치 (Google otp)
bigju
2021. 9. 28. 10:17
설치 환경 : Centos 7.3 , VMware
# 라이브러리 설치
yum install pam-devel gcc autoconf automake libtool git -y
# git 소스 다운로드
git clone https://github.com/google/google-authenticator-libpam
cd google-authenticator/libpam
./bootstrap.sh
./configure --libdir=/lib64
make && make install
# 패키지 설치
yum install google-authenticator -y
yum install epel-release -y
yum install google-authenticator -y
# PAM 설정
vi /etc/pam.d/sshd
auth required pam_google_authenticator.so nullok //마지막 줄 추가
# SSH 서버의 설정 파일 수정
vi /etc/ssh/sshd_config
PasswordAuthentication no
ChallengeResponseAuthentication yes
UsePAM yes
PermitEmptyPasswords no
## 2줄 일 경우 있다. 조심
#시작
systemctl restart sshd.service
#google authenticator 실행
google-authenticator
ㄴ___ 다 y
#QR코드 나오는데 잠시 SKIP 해도 됩니다.
코드확인
# vi .google_authenticator
# 설정
핸드폰 구글 otp 다운 -> 설정하기 -> 이름 적고 .google_authenticator 맨위 코드 적기
프티 접속 해보기
OR
QR 코드 인식 해도 됩니다.
# 설정 완료 !
접속 시 패스워드및 OTP 작성 하라는 안내가 나옵니다.
BigJu