I'm having some trouble changing the ports on a new CentOS 7 (minimal) machine (IP 11.22.33.44). To log into the new machine, I use a proxy VPS (let's say, IP 88.99.100.101).
I edited the /etc/sysconfig/selinux
file to disable SElinux and rebooted.
[root@host ~]# getenforce
Disabled
After I disable selinux and restart the machine, I edit the /etc/ssh/sshd_config
and change the Port
entry from 22 to let's say 7890 (just an example) + systemctl restart sshd.
Then I copy the default ssh xml configuration file for firewalld from /usr/lib/firewalld/services/ssh.xml
to /etc/firewalld/services/ssh.xml
and change the port from 22 to 7890 + firewall-cmd reload
.
I also make the change permanent in firewalld:
firewall-cmd --zone=public --add-port=7890/tcp --permanent
The problem comes when I try to log through SSH to the new CentOS 7 machine from a different VPS. The login from the initial VPS still works after the changes are made to the port number, but no new machines can connect to the CentOS 7 machine.
The error that I'm getting is:
ssh: connect to host 11.22.33.44 port 7890: Connection timed out
This is the output from my ss -ntulp
:
tcp LISTEN 0 128 *:7890 *:* users:(("sshd",5566,3))
The thing is that if I change the SSH port back to the default 22 value, then every machine can connect to it without any problems (after I edit the two files ssh.xml
and sshd_config
to the default 22 port).
There must be something that I'm missing or doing wrong. Can someone point me in the right direction?
Thank you.