CentOS 7.5 modify the sshd port with SElinux and Firewalld Service running

Goal:modify the sshd service port from 22 to 1022.

1. modify the port type

-- Selinux Policy Management tool
-- modify the port type
# semanage port -a -t ssh_port_t -p tcp 1022

2. modify the sshd service port

# vi /etc/ssh/sshd_config
port 1022

3. Restart sshd Service

# systemctl restart sshd.service

4. open firewalld port

# firewall-cmd --zone=public --add-port=22/tcp --permanent
# firewall-cmd --reload

5. display policy

# firewall-cmd --zone=public --list-ports
请使用浏览器的分享功能分享到微信等