CentOS SSH Port Numaras? De?i?tirme

First, we must edit the SSHD (SSH server daemon) configuration file. Use your favorite text editor.

vi /etc/ssh/sshd_config

Add the following code to either the top or the bottom of the configuration file.

# SSH Port
Port 2124  # the port you want to change it to

Next, we’ll update the firewall. If you have disabled the firewall, skip this step. My example uses port 2124. For CentOS 6 users, run these commands:

iptables -I INPUT -p tcp --dport 2124 --syn -j ACCEPT
service iptables save
semanage port -a -t ssh_port_t -p tcp 2124

CentOS 7 users, run these commands instead:

firewall-cmd --add-port 2124/tcp --permanent
firewall-cmd --add-port 2124/tcp

The configuration changes are now finished. Restart the SSH server (SSHD)…

service sshd restart