✓ Changing the port SSH on Linux Centos 7

0 10,018

Changing the port SSH on Linux Centos 7 | One way of securing a server is by transferring the default ports that are used in the backend. One of them port SSH. Here's how to change the SSH port in CentOS 7.
1. Make sure nano already installed, if not, run the command
#yum -y install nano
2. Edit file config SSH
#nano /etc/ssh/sshd_config
3. Search "#Port 22"
4. Remove "#" in front of the Port 22, then replace 22 with the port that you want, for example 2222, then exit and do not forget to save (press Ctrl + X, then press Y)
5. In SELinux only allow port 22 to SSH, if we want to add a new port that we have to edit before we need to add an allow in port 2222 so read on SELinux. How:
#semanage port -a -t ssh_port_t -p tcp 2222
6. If semanage not installed, install a manner:
# yum -y install policycoreutils-python
7. After install, run the command again manage.
#semanage port -a -t ssh_port_t -p tcp 2222
8. Register port 2222 centos firewall 7 and we reload his firewall
#firewall-cmd –permanent –zone=public –add-port=2222/tcp
#firewall-cmd –reload
9. Restart SSH
#service sshd restart
10. SSH pport pernggantian process checks in a way
#ss -tnlp | grep ssh

Get real time updates directly on you device, subscribe now.

You might also like

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More