Published on

Amazon Web Services - 비밀번호 접속 활성화

Authors
  • avatar
    Name
    성기동
    Twitter

아마존 웹 서비스(AWS)에서 생성한 EC2 인스턴스는 기본적으로 생성시 발급한 공개키로만 접근하도록 설정되어있다. 당연히 이 방법이 가장 뛰어난 보안성을 제공하지만 경우에 따라서 Password Access가 필요한 상황도 있다. 다음과 같이 설정을 한 후 sshd 서비스를 재시작하면 비밀번호를 사용해 SSH 접속이 가능하다.

Ubuntu 14.04 기준입니다.

sshd_config 수정

sudo vi /etc/ssh/sshd_config
# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

EC2로 생성된 인스턴스는 기본적으로 PasswordAuthentication 항목이 no로 설정되어 있다. 이 부분을 yes로 변경하거나 주석처리 해주면 공개키 파일을 사용하지 않고 외부에서 ID/Password를 사용해 ssh 접속이 가능하다.

SSH 서비스 재시작

sudo service ssh restart

수정한 sshd_config를 읽어오기 위한 서비스 재시작. 해당 설정이 제대로 적용되고 AWS Console의 EC2-Security Group에서 해당 포트가 제대로 열려있다면 공개키 파일을 사용하지 않고 ID/Password로 접속 가능하다.

계정생성

sudo su
adduser 계정명
usermod -aG sudo 계정명