Change default SSH port on Fedora

I wanted to change my default SSH port to something else. Here are the commands I used:

  1. I modified the "Port" value in my SSH config:
vi /etc/ssh/sshd_config

It was commented out. I uncommented it and modified it.

  1. I installed "policycoreutils-python-utils" to gain access to the "semanage" command:
yum install policycoreutils-python-utils
  1. I ran "semanage" to add my preferred SSH port to the allowed SSH ports:
semanage port -a -t ssh_port_t -p tcp xxxx
  1. I checked to make sure it succeeded:
semanage port -l | grep ssh_port_t
  1. I added a firewall exception for my preferred SSH port:
firewall-cmd --permanent --service="ssh" --add-port "xxxx/tcp"
  1. I reloaded my firewall and SSH:
firewall-cmd --reload
systemctl reload sshd
  1. I rebooted to make sure it all still worked correctly on boot:
reboot

fedora ssh