Skip to main content

Raymii.org Raymii.org Logo

Quis custodiet ipsos custodes?
Home | About | All pages | Cluster Status | RSS Feed

Fix CentOS IPTables rule saving (iptables: Saving firewall rules to /etc/sysconfig/iptables: /etc/init.d/iptables: line 274: restorecon: command not found)

Published: 23-01-2013 | Author: Remy van Elst | Text only version of this article


❗ This post is over twelve years old. It may no longer be up to date. Opinions may have changed.

On a default CentOS installation, when trying to execute the service iptables save command you can get an error like iptables: Saving firewall rules to /etc/sysconfig/iptables: /etc/init.d/iptables: line 274: restorecon: command not found.

Recently I removed all Google Ads from this site due to their invasive tracking, as well as Google Analytics. Please, if you found this content useful, consider a small donation using any of the options below. It means the world to me if you show your appreciation and you'll help pay the server costs:

GitHub Sponsorship

PCBWay referral link (You get $5, I get $20 after you've placed an order)

Digital Ocea referral link ($200 credit for 60 days. Spend $25 after your credit expires and I'll get $25!)

This is fixed easily by installing the policycoreutils package, which is available in the default CentOS repositories:

yum install policycoreutils

After installation the service iptables save command works without errors.

Tags: centos , firewall , iptables , network , selinux , snippets