To change the port for the SSH server, follow these steps:

  • Log in to the server as root 
  • Open the /etc/ssh/sshd_config file in your preferred text editor 
  • Locate the following line: Port 22 and changed to New Port 2233
  • Restart SSHD Service.


Use the following command for enabling additional SSH Port

sed -i 's/#Port 22/Port 22\nPort 2233/g' /etc/ssh/sshd_config


Firewall Configuration

firewall-cmd --add-port=2233/tcp --permanent

firewall-cmd --reload

Restart the SSH service using the following command

systemctl restart sshd

Remove Default SSH Port from Firewall

firewall-cmd --remove-service=ssh --permanent

firewall-cmd --reload

Install dependancies

yum install -y policycoreutils-python

Allow New SSH Ports - SeLinux 

semanage port -a -t ssh_port_t -p tcp 2233

Verify SSH Ports Enable

semanage port -l | grep ssh

Now you can able to access through New Port.