CHANING DEFAULT PORT OF SSH AND PORT FORWARDING IN RHEL/CENTOS 8 LINUX
DO VISIT; https://www.musab.in
To change the default port of ssh from 22 to 2222 in rhel and centos 8
Step1: edit /etc/ssh/sshd_config file
Step2: Allow custom port in selinux
semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
Step3: Allow custom port in firewall
firewall-cmd –add-port=2222/tcp –permanent
firewall-cmd –reload
Step4: restart or reload sshd services
systemctl reload sshd
PORT FORWARDING USING FIREWALLD
firewall-cmd –add-forward-port=port=22:proto=tcp:toport=2222 –permanent
firewall-cmd –reload
centos 8