INFORMATICS

The Best

Przełącznik języka

This Site

CMS

Hardware

Uncategorised

useful sites

Databases

Emulators

Powershell

Storage Array

DNS

Antivirus program

Licznik

1.png8.png7.png9.png5.png2.png2.png
Today403
Yesterday638
This week1563
This month14023
Total1879522

Visitor Info

  • IP: 52.3.228.47
  • Browser: Unknown
  • Browser Version:
  • Operating System: Unknown

Who Is Online

21
Online

Monday, 21 September 2020 11:30

Change SSH Port on CentOS

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

Change SSH Port on CentOS 8
First, create a backup of sshd_config.
# cp/etc/ssh/sshd_config/etc/ssh/sshd_config_backup
Then open your ssh configuration to change it
# sudo nano /etc/ssh/sshd_config
This command will open the SSH (SSHD) server configuration.

We make the following change to the sshd_config file
# SSH port
Port 11111 # port that needs to be changed

 

We then update the IPTABLES firewall by introducing a new SSHD port.
If you have your firewall turned off, you can skip this step.
If you are using centos 6, you can run this command
For centOS 6
# iptables -I INPUT -p tcp --dport 11111 --syn -j ACCEPT
# service iptables save
# semanage port -a -t ssh_port_t -p tcp 11111
For centOS 7/8
# firewall-cmd --add-port 11111/tcp --permanent
# firewall-cmd --add-port 11111/tcp
The configuration will start working after restarting SSH Server (SSHD) services or after restarting the server.

# service sshd resrtart
or
# systemctl restart sshd

If you have trouble getting to SSHD, you need to configure SELinux policy since you changed port 22 to 11111.

Run this command.
# semanage port -a -t ssh_port_t -p tcp 11111
Then restart the server.
# reboot

 

Search