Greg Donald : Change default SSH port on Fedora Page

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.

2) I installed "policycoreutils-python-utils" to gain access to the "semanage" command:

yum install policycoreutils-python-utils

3) I ran "semanage" to add my preferred SSH port to the allowed SSH ports: 

semanage port -a -t ssh_port_t -p tcp xxxx

4) I checked to make sure it succeeded:

semanage port -l | grep ssh_port_t

5) I added a firewall exception for my preferred SSH port:

firewall-cmd --permanent --service="ssh" --add-port "xxxx/tcp"

6) I reloaded my firewall and SSH:

firewall-cmd --reload
systemctl reload sshd

7) I rebooted to make sure it all still worked correctly on boot:

reboot

fedora (1) ssh (1)