특정 IP만 SSH 접속 허용하기 > 자유게시판

자유게시판

특정 IP만 SSH 접속 허용하기 정보

특정 IP만 SSH 접속 허용하기

본문

서버관리시 Root를 사용하기 위해 특정 IP만 SSH에 접속 가능 하도록 아래 방법으로 수정해 보았습니다.

 

/etc/hosts.allow 수정

#
# hosts.allow This file describes the names of the hosts which are
# allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
sshd: 113.157.124.168, 135.79.246.

→ 113.157.124.168와 135.79.246.XXX 대역을 허용
위와 같이 한줄에 적어도 되지만, 아이피가 많아지면 관리가 어렵다. 아래와 같이 여러줄로 나누어 적어도 된다.
sshd: 113.157.124.168
sshd: 135.79.246.


/etc/hosts.deny 수정

#
# hosts.deny This file describes the names of the hosts which are
# *not* allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow. In particular
# you should know that NFS uses portmap!
sshd: ALL

ALL 적용시 나머지는 모두 ssh 접근 불가 sshd 재시작 해야 정상 적용된다.

# service sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]

 

출처 : http://www.nanoomi.org/bbs/board.php?bo_table=03_2&wr_id=5&page=2 

추천
0
  • 복사

댓글 2개

© SIRSOFT
현재 페이지 제일 처음으로