리눅스 hosts.allow hosts.deny sshd_config 설정 방법

centos ssh 접속 ip 제한

/etc/ 경로에 있는 hosts.allow와 hosts.deny를 편집해서 화이트리스트, 블랙리스트로 접근 권한을 관리할 수 있습니다.

vim hosts

 

허용IP 설정 방법

# hosts.allow This file contains access rules which are used to

# allow or deny connections to network services that

# either use the tcp_wrappers library or that have been

# started through a tcp_wrappers-enabled xinetd.

#

# See 'man 5 hosts_options' and 'man 5 hosts_access'

# for information on rule syntax.

# See 'man tcpd' for information on tcp_wrappers

#

ALL:10.10.10.1:allow

ALL:127.0.0.1:allow

ALL:허용할IP:allow

 

차단IP 설정 방법

 

root 계정 직접 로그인 허용 방법

/etc/sshd/sshd_config 파일 수정

root 계정 로그인 권한 yes로 설정해 줍니다.

주석 해제하고 no -> yes

PermitRootLogin yes

 

ssh 서비스와 슈퍼 서비스 데몬인 xinetd(네트워크, tcp, hosts 관련 서비스 관리)를 재기동해줍니다.

service xinetd restart

service sshd restart

댓글

Designed by JB FACTORY