centos7 ssh 포트번호 변경하기

by 자꾸만 posted Jan 31, 2016
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄

centos7 설치가 막 완료된 상태에서 설명 입니다.

 

1. yum install -y net-tools

 

> 네트워크 활성화

 

2. yum update

 

> 업데이트

 

3. systemctl mask firewalld

   systemctl stop firewalld

 

> 2개의 명령어로 방화벽을 정지 합니다.

 

4. yum install -y iptables-services

 

> iptables 서비스 관련 패키지 설치 합니다.

 

5. systemctl enable iptables

 

> iptables 기본으로 사용 할 수 있게 설정

 

6. systemctl start iptables

 

> iptables 서비스 시작

 

7. iptables -nL

 

> 정상작동하는지 확인

 

8. vi /etc/ssh/sshd_config

 

> ssh 설정 페이지 오픈

 

9. Port 22 주석 해제 및 원하는 포트로 변경

 

10. PermitRootLogin no 로 활성화 해주면 root 아이디 접속 안되게 막음

 

11. Allowusers 아이디 아이디1 아이디2

 

> 아이디 아이디1 아이디2 로만 ssh 접속 가능하게 만듬

 

12. /etc/init.d/sshd restart

 

>sshd 재시작

 

13. vi /etc/sysconfig/iptables

 

> iptables 설정 페이지를 오픈 해서 22 로 되어 있는 포트를 원하는 포트로 변경합니다.

 

14. vi /etc/sysconfig/selinux

 

15. SELINUX=disabled

 

> 방화벽을 해제해 줍니다.

 

재시작을 해서 사용 합니다.