I'm having some trouble changing the ports on a new CentOS 7 (minimal) machine (IP 18.104.22.168). To log into the new machine, I use a proxy VPS (let's say, IP 22.214.171.124).
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
/etc/firewalld/services/ssh.xml and change the port from 22 to 7890 +
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 126.96.36.199 port 7890: Connection timed out
This is the output from my
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
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?