OS
[리눅스] ssh 포트 변경
꼬장e
2021. 3. 12. 11:12
vi /etc/ssh/sshd_config 수정
port 22 원하는걸로 변경
systemctl restart sshd 재시작
오류나면
semanage port -a -t ssh_port_t -p tcp 2244
semaange 없다면
yum install policycoreutils-python1. sshd_config 설정파일 변경
vi /etc/ssh/sshd_config
2. #Port 로 주석처리된 부분아래 또는 주석을 지우고 변경하고자 하는 포트번호 입력(ex>1234)
...
#Port 22
Port 1234
...
3. sshd 재시작
service sshd restart
재시작후 아래와 같은 애러 발생시 4. 이후 내용을 진행
Job for sshd.service failed because the control process exited with error code. See "systemctl status sshd.service" and "journalctl -xe" for details.
4. semanage 미설치시 아래 명령어로 설치
yum install policycoreutils-python
5. 설치 후 ssh 포트 확인
semanage port -l | grep ssh
6. ssh 포트 변경
semanage port -a -t ssh_port_t -p tcp 포트번호