본문 바로가기
OS/Linux

ssh / port 수정

by 하하IT 2020. 4. 17.

sshd port 수정

 

[CentOS 6.x]

 

vi /etc/ssh/sshd_config

Port 포트번호

service sshd restart

 

 

 

방화벽 해당port추가

 

vi /etc/sysconfig/iptables

 

-A INPUT -m state –state NEW -m tcp -p tcp –dport 포트번호 -j ACCEPT

 

service iptables restart

 

 

[CentOS 7.x]

 

vi /etc/ssh/sshd_config

...

#Port 22

Port 새로운 포트번호

...

service sshd restart

 

 

방화벽 해당port추가

firewall-cmd --permanent --zone=public --add-port=5050/tcp

 

방화벽 재시작

firewall-cmd --reload

 

 

SELINUX 확인

/etc/sysconfig/selinux

...

#SELINUX=enforcing

SELINUX=disable

..

 

 

 

Port Permission denied  Error  처리방법 

 

 

-- Unit sshd.service has begun starting up.

Nov 06 23:47:02 Server sshd[2137]: error: Bind to port xxxx on :: failed: Permission denied.

Nov 06 23:47:02 Server sshd[2137]: error: Bind to port xxxx on 0.0.0.0 failed: Permission denied.

Nov 06 23:47:02 Server sshd[2137]: fatal: Cannot bind any address.

Nov 06 23:47:02 Server systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a

Nov 06 23:47:02 Server systemd[1]: Failed to start OpenSSH server daemon.

-- Subject: Unit sshd.service has failed

-- Defined-By: systemd

-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

--

-- Unit sshd.service has failed.

--

-- The result is failed.

 

 

# setenforce 0     :: SElinux 정지

 

# getenforce        :: SElinux 확인

 

# service sshd restart

 

# setenforce 1       :: SElinux 시작

'OS > Linux' 카테고리의 다른 글

crontab / crond  (0) 2020.04.17
yum / update / 자동 업데이트  (0) 2020.04.17
Centos 7 / network config CLI  (0) 2020.04.16
CentOS 설치 후 기본작업내용  (0) 2019.04.15
[centos] Centos 설치 후 처리  (0) 2019.04.12