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
Table of Contents
On a default CentOS installation, when trying to execute the
service iptablessave command you can get an error like
iptables: Saving firewall rules to/etc/sysconfig/iptables: /etc/init.d/iptables: line 274: restorecon: command notfound.
If you like this article, consider sponsoring me by trying out a Digital OceanVPS. With this link you'll get $100 credit for 60 days). (referral link)
This is fixed easily by installing the
policycoreutils package, which isavailable in the default CentOS repositories:
yum install policycoreutils
After installation the
service iptables save command works without errors.