리눅스 SSH 포트변경 및 Root 계정 접속
- 사용 OS Ver: CentOS 7.4
1. 리눅스 SSH 포트변경 방법
vi 에디터로 sshd_config 파일 편집
[root@localhost ~]# vi /etc/ssh/sshd_config |
Port 검색('/Port') 및 주석 제거 후 원하는 포트로 변경 (예제 22 >> 4321)
변경 전 #Port 22 변경 후 Port 4321 |
sshd 서비스 재시작
[root@localhost ~]# systemctl restart sshd |
변경된 포트 확인
[root@localhost ~]# netstat -lntp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1455/cupsd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1662/master tcp 0 0 0.0.0.0:4321 0.0.0.0:* LISTEN 1457/sshd tcp6 0 0 :::111 :::* LISTEN 1/systemd tcp6 0 0 ::1:631 :::* LISTEN 1455/cupsd tcp6 0 0 ::1:25 :::* LISTEN 1662/master tcp6 0 0 :::4321 :::* LISTEN 1457/sshd tcp6 0 0 :::1311 :::* LISTEN 1786/dsm_om_connsvc |
2. SSH root 계정 접속/차단 방법
vi 에디터로 sshd_config 파일 편집
[root@localhost ~]# vi /etc/ssh/sshd_config |
Port 검색('/PermitRootLogin') 및 주석 제거 후 원하는 설정으로 변경(허용: yes / 차단:no)
변경 전 #PermitRootLogin yes 변경 후 - 허용 PermitRootLogin yes 변경 후 - 차단 PermitRootLogin no |
'LINUX' 카테고리의 다른 글
[리눅스] DELL Dell OpenManage Server Administrator(OMSA) Installation Guide (0) | 2018.05.23 |
---|---|
[리눅스] 열린 포트 확인 (0) | 2018.05.23 |
[리눅스] ISO 마운트 및 자동 마운트(fstab) (0) | 2018.05.18 |
[리눅스] 서버간 파일복사 SCP 사용법 (다운로드, 업로드) (0) | 2018.05.18 |
[리눅스] CentOS Chrome 크롬 설치하기 (0) | 2015.07.09 |