The key step is to turn your want listen-port and close the default ssh-port.
For CentOS 8, will use firewalld
sudo firewall-cmd --zone=public --permanent --add-port=30000/tcp
sudo firewall-cmd --zone=public --permanent --remove-service=ssh
If firewalld not installed, you can manually install and enable it.
sudo yum -y install firewalld
sudo systemctl enable --now firewalld
And then, reload it:
sudo firewall-cmd --reload
It will use semange:
sudo semanage port -a -t ssh_port_t -p tcp 3000
which is to set new port, and then:
semanage port -l | grep ssh
it will be answered:
ssh_port_t tcp 3000
Use netstat to confirm:
$ netstat -tunl | grep 3000
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN
tcp6 0 0 :::3000 :::*
and finally, restart ssh service:
sudo systemctl restart sshd
Now, you can ssh your serve at -p 3000, like:
ssh [email protected] -p3000