I recently did a yum update and reboot, and now I can't SSH into my machine. I use a non-standard SSH port (let's say 444) and when I run nmap <MY-IP> -p444 --reason I get 444/tcp filtered unknown host-prohibited. If I run -p22 instead I get 22/tcp closed ssh.

I've booted into the rescue mode and mounted my disk and I'm unclear where iptables rules are stored. I think they should be in /etc/sysconfig/iptables, but that file doesn't exist. I got this server a while ago for an experiment and it is possible that I never set any firewall rules up. But if that's the case then what's filtering port 444? Could it be something other than iptables - if so how do I find it?

Thank you!


You are using non-standard port for SSH. SELinux must have relabeled the file contexts after system reboot.

To temporarily disable SELinux

$ sudo setenforce 0

If you decide to keep using non-standard port for SSH while SELinux enabled, use the semanage command:

$ sudo semanage port -a -t ssh_port_t -p tcp 4444

Then allow add the port to firewall exceptions:

$ sudo firewall-cmd --add-port=4444/tcp --permanent
$ sudo firewall-cmd --reload

To disable SELinux permanently, follow this guide

  • SELinux is already disabled, so it wasn't that. – Codemonkey Oct 21 '20 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.