웹 개발 /리눅스

openssh 보안 설정

호박털이범 2016. 9. 28. 23:37

OpenSSH 옵션은 /etc /ssh/sshd_config 파일에서 설정



1. 루트로그인 차단 (PermitRootLogin)

   # vi /etc/ssh/sshd_config
      PermitRootLogin no


2. 특정 그룹 또는 유져만  접속가능

  # vi /etc/ssh/sshd_config
     AllowUsers bobo john jason

 # vi /etc/ssh/sshd_config
    AllowGroups sysadmin dba


3. 특정 그룹 또는 유져 접속차단

 # vi /etc/ssh/sshd_config
   DenyUsers cvs apache jane

 # vi /etc/ssh/sshd_config
   DenyGroups developers qa


4. sshd 포트넘버 변경 (Port)

  # vi /etc/ssh/sshd_config
    Port 2222


5. 지정시간내 로그인 유효시간  (LoginGrace Time)

  # vi /etc/ssh/sshd_config
    LoginGraceTime 1m (기본 1분지정, 0은 시간제한없음)


6. sshd Listen Address

  # vi /etc/ssh/sshd_config
    ListenAddress 192.168.0.200


7. 접속후 아무작업이 없을때 접속끊기

  # vi /etc/ssh/sshd_config
   ClientAliveInterval 600   ( 기본 0 보내지않음. 10분간격으로 클라이언트로 메시지를 보내고 응답한다.)
   ClientAliveCountMax 3  (클라이언트에서 응답이 없을 때 메시지를 보내는 횟수)