/etc/init.d/iptables: line 268: restorecon: command not found


After adding a new rule in iptables, it is needed to save those rule and restart iptables.
When saving iptables rule,

# root@server [~]# service iptables save

iptables: Saving firewall rules to /etc/sysconfig/iptables: /etc/init.d/iptables: line 268: restorecon: command not found

The rules will not be saved and we will keep getting the above error when saving iptables.


The reason in getting such an error message is because of the  missisng of restorecon file.

See the result of the follwing command, 'restorecon' is missiing in there.

root@server [~]# ls -l /sbin/ | grep restore
lrwxrwxrwx  1 root root         14 Jan  9 22:23 iptables-restore -> iptables-multi*

restorecon is provided by policycoreutils package. Try re-installing policycoreutils package and see the result of the above command.

# yum update policycoreutils

After the update, run the following command to check whether 'restorecon' available or not.

root@server [~]# ls -l /sbin/ | grep restore
lrwxrwxrwx  1 root root         14 Jan  9 22:23 iptables-restore -> iptables-multi*
lrwxrwxrwx  1 root root          8 Jan 15 19:50 restorecon -> setfiles*

If you get an output as like above, it will fix the above iptables save issue.

This entry was posted by Unknown. Bookmark the permalink.

One thought on “/etc/init.d/iptables: line 268: restorecon: command not found”

  1. The effectiveness of IEEE Project Domains depends very much on the situation in which they are applied. In order to further improve IEEE Final Year Project Domains practices we need to explicitly describe and utilise our knowledge about software domains of software engineering Final Year Project Domains for CSE technologies. This paper suggests a modelling formalism for supporting systematic reuse of software engineering technologies during planning of software projects and improvement programmes in Project Centers in Chennai for CSE.

    Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Spring Framework Corporate TRaining the authors explore the idea of using Java in Big Data platforms.
    Specifically, Spring Framework provides various tasks are geared around preparing data for further analysis and visualization. Spring Training in Chennai