Google 인증기를 사용하는 Ubuntu 사용자를 위해 Ubuntu에서 2 단계 인증을 설정하는 방법은 무엇입니까?

Hrish

Google 인증기를 사용하는 Ubuntu 사용자를 위해 Ubuntu에서 2 단계 인증을 설정하는 방법 (Google 인증이 아닌 계정에 대해서도 설정할 수 있음)?

Hrish

참고 : 사용자에 대해 2 단계 인증을 활성화하고 루트에 대해 동일하게 설정하지 않으면 루트로 직접 로그인 할 수 없습니다. 이러한 경우에 대한 방법은 우리가 설정 한 다른 sudo 사용자를 사용한 다음 sudo su -루트 사용자로 전환하는 데 사용하는 것입니다.


설정하려면 아래 단계를 사용하십시오.

  1. PAM 인증과 함께 추가 기능으로 사용할 Google 인증기를 설치하려면 아래 제공된 패키지를 설치하십시오.

    sudo apt-get install libpam-google-authenticator
    
  2. 이제이 /etc/pam.d/sshd파일을 편집 하고 아래와 같이 Google Authenticator를 추가합니다.

    *sudo vim /etc/pam.d/sshd
    

    이 파일 상단에 아래 입력-

    auth required pam_google_authenticator.so
    
  3. 여기서는 /etc/ssh/sshd_configssh가 Google Authenticator를 사용 하도록 변경 해야합니다. 이렇게하면 ssh가 2 단계 인증을 사용하는지 확인합니다.

    vim /etc/ssh/sshd_config
    

    이 파일에서 우리는 찾아서 ChallengeResponseAuthentication주석을 제거하거나 아래처럼 보이도록 수정해야합니다 (짧게 yes : P로 설정) :

    ChallengeResponseAuthentication yes
    

    추가 또는 GUI 2 단계 인증이 아니면 건너 뛰고 4 단계로 이동 하십시오. GUI 로그인을 위해 활성화하려면 다음 을 편집하십시오 /etc/pam.d/common-auth.

    sudo vim /etc/pam.d/common-auth
    

    이제 이것을 auth required pam_google_authenticator.so줄 위에 추가 auth [success=1 default=ignore] pam_unix.so nullok_secure하고 파일을 저장하십시오.

  4. 이제 설정하려는 계정으로 변경하십시오.
    ( 참고 : 루트 계정과 별도로 시스템에 두 개 이상의 슈퍼 사용자 계정을 만들고 루트 계정이 아닌 둘 중 하나에 대해 먼저 구성하는 것이 좋습니다.)

    sudo su - testuser1
    
  5. 이제 아래 명령을 사용하여 이에 대한 이중 인증을 설정합니다 testuser1.

    google-authenticator
    
  6. 이 명령을 실행하면 아래 질문이 표시됩니다. (권장 답변 예)

    인증 토큰이 시간 기반 (y / n)이되도록 하시겠습니까? y

  7. 그 후에 QR 코드와 긴급 스크래치 코드 및 기타 세부 정보가 표시됩니다. 출력은 주어진 이미지와 같이 보여야합니다.

    여기에 이미지 설명 입력

  8. Now you need to use your Android / Apple / Blackberry phone to download & install the Google Authenticator Application from the respective market places for example Google play store. which will generate code for you to login.

    Below are the screenshot of the application Icon and application taken from application Android phone.

    여기에 이미지 설명 입력 여기에 이미지 설명 입력

  9. Start the application on your phone and scan the QR Code or else use the secret key and the verification code given below the QR code on the system, which you can also see in the first screenshot above.

  10. Once all of this is done it is very important to note down and save your emergency scratch codes on a safe place, as those are the codes which can help you in case you get locked out somehow.

  11. At this point in time you should take a look at the bottom of the screen where it is asking you a below question. (recommended answer is Yes):

    Do you want me to update your "/home/testuser1/.google_authenticator" file (y/n) y

  12. Again it will ask you one more question and the recommended answer for below question is also Yes:

    Do you want to disallow multiple uses of the same authentication token? This restricts you to one login about every 30s, but it increases your chances to notice or even prevent man-in-the-middle attacks (y/n) y

  13. Next question would be as given below and the recommended answer for it is No:

    By default, tokens are good for 30 seconds and in order to compensate for possible time-skew between the client and the server, we allow an extra token before and after the current time. If you experience problems with poor time synchronization, you can increase the window from its default size of 1:30min to about 4min. Do you want to do so (y/n) n

  14. And the last question would be as given below and recommended answer for it is Yes:

    If the computer that you are logging into isn't hardened against brute-force login attempts, you can enable rate-limiting for the authentication module. By default, this limits attackers to no more than 3 login attempts every 30s. Do you want to enable rate-limiting (y/n) y

  15. Now switch exit from this account to go back to root account:

    exit
    
  16. 이제 ssh 서비스를 다시 시작하십시오.

    service ssh restart
    

이제 설정 한 사용자에 대해 ssh 세션을 수행하면 먼저 모바일에서 입력 할 수있는 인증 코드를 요청한 다음 사용자 비밀번호를 요청합니다.

여기에 이미지 설명 입력

이것이 2 단계 인증을 설정하는 데 필요한 모든 것입니다. 필요한 경우 답변을 개선하고 그다지 좋지 않은 언어로 인해 실례합니다.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관