[Troubleshooting] PasswordAuthentication no not work

SSH(Secure Shell)는 원격으로 시스템에 접속하고 관리하는 데 사용되는 보안 프로토콜
“PasswordAuthentication no”라는 옵션은 SSH 서버 구성에서 중요한 부분으로, 이를 통해 비밀번호를 사용한 인증을 비활성화하는 것이 가능
설정하는 과정에서 PasswordAuthentication no를 추가해도 작동하지 않았고 이에 따른 해결 과정 기록

  • sshd_config 파일 열기

    sudo vi /etc/ssh/sshd_config
    
  • PasswordAuthentication no 작성

    image-20230820181645952

  • 재시작

    sudo service sshd restart
    

Troubleshooting

재시작을 완료 했는 데도 password로 계속 접속이 되는 현상 발생

  • 폴더 확인

    ls /etc/ssh/sshd_config.d
    
    > 50-cloud-init.conf
    
  • 파일 수정

    sudo vi /etc/ssh/sshd_config.d/50-cloud-init.conf
    

    image-20230820182132105

    yes가 되어 있는 것을 확인 no로 수정 후 저장 [:wq]

  • 재시작

    sudo service sshd restart
    

Result

image-20230820182235220

정확한 원인은 sshd_config 안에서 /sshd_config.d 폴더 안의 conf 파일들이 Include되는 과정에서 PasswordAuthentication yes가 먼저 선언 되었기 때문이였습니다.

댓글남기기