How To Change SSH Port On CentOS 7

To change the default SSH port, the first thing you want to do is backup the current SSH configuration on your system. To do that, run the commands below.

cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak

Next, run the commands below to open the default SSH configuration file

sudo vi /etc/ssh/sshd_config

# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
#
Port 2244
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

Save the file.

After saving, don’t exit until you’ve completed these steps.
Read the rest of this entry »