개요
- OCI 리눅스 인스턴스는 기본적으로 SSH Key Pair을 사용합니다. Key 방식이 아닌 패스워드 방식으로 적용하기 위해서는 최소 1회 로그인 해야 합니다.
방법
사전 작업
- 사용자 추가
sudo useradd testuser
- 사용자 패스워드 변경
- 패스워드 복잡성 설정은
/etc/security/pwquality.conf에서 확인 가능
cat /etc/security/pwquality.conf
예시 설정 항목:
- 최소 길이:
minlen=15 - 동일 문자 반복 제한:
maxrepeat=3 - 최소 숫자:
dcredit=-1 - 최소 특수문자:
ocredit=-1 - 최소 대문자:
ucredit=-1 - 최소 소문자:
lcredit=-1 - 최소 문자 유형 수:
minclass=4
패스워드 변경:
sudo passwd testuser
Compute Instance / ExaCS
- 계정 패스워드 설정
sudo passwd opc
/etc/ssh/sshd_config수정
sudo vi /etc/ssh/sshd_config
# 기존
PasswordAuthentication no
# 변경
PasswordAuthentication yes
- sshd 서비스 재시작 및 확인
sudo systemctl restart sshd
sudo systemctl status sshd
- 터미널 접속 테스트
ssh opc@<IP주소>
Oracle Linux 9.3 이상 (Match User 필요)
/etc/ssh/sshd_config수정
# 기존 설정 유지
PasswordAuthentication no
# 파일 마지막에 추가
Match User opc
PasswordAuthentication yes
Match all
- 서비스 재시작 및 상태 확인
sudo systemctl restart sshd
sudo systemctl status sshd
DBCS 환경 설정
- 계정 패스워드 설정
sudo passwd opc
/etc/ssh/sshd_config수정
# grid, oracle 이외 유저는 명시적으로 추가 필요
AllowUsers opc testuser
- 서비스 재시작 및 상태 확인
sudo systemctl restart sshd
sudo systemctl status sshd
- SSH 접속 테스트
ssh opc@<IP주소>
ETC: DBCS에서 패스워드 인증 오류 발생 시
1. 패스워드 변경 시 오류
passwd: Authentication token manipulation error
2. 원인: PAM 설정 파일 순서 문제
- 확인 파일:
/etc/pam.d/password-auth/etc/pam.d/system-auth
3. 수정 예시
# 수정 전
password requisite pam_pwquality.so ...
password required pam_deny.so
password sufficient pam_unix.so ...
# 수정 후
password requisite pam_pwquality.so ...
password sufficient pam_unix.so ...
password required pam_deny.so
Cloud-init 기반 사용자 자동 추가 스크립트
OCI, AWS, Azure 등의 클라우드 인스턴스는 cloud-init을 통해 인스턴스 생성 시 사용자 및 SSH 설정을 자동화할 수 있습니다.
사용자 생성 + 패스워드 로그인 허용 예시
#cloud-config
users:
- name: testuser
gecos: "Test User"
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
lock_passwd: false
plain_text_passwd: "TestPassword123!"
ssh-authorized-keys:
- ssh-rsa AAAAB3...your_ssh_key_here
ssh_pwauth: true
runcmd:
- sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
- systemctl restart sshd
위 cloud-init 스크립트는 "testuser"라는 계정을 생성하고, SSH 패스워드 인증을 허용합니다.
plain_text_passwd는 보안상 비추천이며, 테스트 환경 또는 초기 설정 후 변경을 권장합니다.
참고 문서
'Cloud > OCI' 카테고리의 다른 글
| Oracle DB 11g → 19c → 23ai 대응을 위한 WAS(JDK) 및 JDBC 업그레이드 (0) | 2025.06.01 |
|---|---|
| [Linux] OCI resolv.conf, hosts 파일 변경 유지 방법 (0) | 2025.05.31 |
| [ OracleDB ] EM Express 활성화 (0) | 2025.05.20 |
| [OCI] Windows License 정책 (0) | 2025.05.20 |
| Oracle basedb dbcli 스케줄 및 백업 확인 및 장애 확인 (0) | 2025.05.19 |
