How to modify remote ports in CentOS 7 and 8 Print

  • 5233

How to modify remote ports in CentOS 7 and 8

1. SSH remote login to the server

2. Enter (change port policy, allow firewall to pass policy, restart SSH):

(e.g.: port 55022)

sed -i 's/#Port 22/Port 55022/' /etc/ssh/sshd_config

sed -i 's/^Port.*/Port 55022/' /etc/ssh/sshd_config

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

firewall-cmd --reload

systemctl restart sshd

3. Log back in to SSH

4. CentOS7 and 8 port modifications are complete


Was this answer helpful?

« Back