728x90
반응형

문제 확인

  1. SSH 접속 포트번호를 변경하기 위해서 /etc/ssh/sshd_config 파일 수정
  2. 변경한 설정 파일 적용을 위해 sshd 데몬 재시작 시 오류 발생
systemctl restart sshd

#위 코드 실행 시 아래와 같은 에러 문구 출력
Job for sshd.service failed because the control process exited with error code. 
See "systemctl status sshd.service" and "journalctl -xe" for details.

 

원인 파악

  • selinux가 활성화(enforcing) 상태이기 때문에 발생한 문제로 파악

 

해결 방안

  1. selinux Permissive로 전환 [아래 코드 참조]

      - SELinux는 enforcing, permissive, disabled 세 가지 정책을 설정 할 수 있다.

      - setenforce 1 = enforcing =  보안 정책 적용

      - setenforce 0 = permissive = 경고만 출력

      - disabled = 아예 로딩하지 않음

#임시 설정 변경
setenforce 0          # permissive
getenforce            # 현재 설정 확인

#getenforce 명령어 입력 시 아래와 같은 출력이 나오면 정상 적용
Permissive

 

    2. selinux disabled로 설정 변경

# /etc/sysconfig/selinux 해당 경로 아래와 같이 disabled로 변경


# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

 

추가 확인 사항

sshd 포트 번호 변경 후 정상 접속이 안될 경우 해당 포트 방화벽이 open 되어 있는지 확인이 필요하다.

 

 

728x90
반응형