CentOS 리눅스 서버단에서 특정 IP SSH 접속 제한 설정 가능

 

[설정 방법]

1. 허용 IP 설정 : /etc/hosts.allow 파일내에 접속 허용할 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:127.0.0.1:allow

ALL:xxx.xxx.xxx.xxx:allow

 

2. 차단 IP 설정 : /etc/hosts.deny 파일을 하기와 같이 설정하면 hosts.allow 내에 설정되어 있는 IP를 제외한 나머지 ALL DENY

 

#
# hosts.deny This file contains access rules which are used to
# deny connections to network services that either use
# the tcp_wrappers library or that have been
# started through a tcp_wrappers-enabled xinetd.
#
# The rules in this file can also be set up in
# /etc/hosts.allow with a 'deny' option instead.
#
# See 'man 5 hosts_options' and 'man 5 hosts_access'
# for information on rule syntax.
# See 'man tcpd' for information on tcp_wrappers
#

ALL:ALL

 

+ Recent posts