Why does "Permission Denied" error appear while resetting the file permissions of some configuration files to default with root credentials?

Solution Verified - Updated -

Issue

  • Why does "Permission Denied" error appear while resetting the file permissions of some configuration files to default with root credentials?
  • During yum update, the error appeared on screen as follows.
The error states for policycoreutils the following:
Error unpacking rpm package policycoreutils-1.33.12-14.13.el5.x86_64
error: unpacking archive failed on file /etc/selinux/restorecond.conf;53f5f96c: cpio: open
Failed on the policycoreutils package
  • Secondly, similar failures for the selinux-policy-targeted package as well with the following errors:
cp: cannot remove '/etc/selinux/targeted/contexts/files/file_contexts.pre': Permission denied
Error in PREIN scriptlet in rpm package selinux-policy-targeted-2.4.6-346.el5.noarch
error: %pre(selinux-policy-targeted-2.4.6-3466.el5.noarch) scriptlet failed, exist status 1
error: install: %pre scroptlet failed (2), skipping selinux-policy-targeted-2.4.6-3466.el5
  • The following commands failed as well
# rpm --setperms policycoreutils
# rpm --setperms selinux-policy
# rpm --setugids policycoreutils
# rpm --setugids selinux-policy
  • The detailed output was as follows.
# rpm --setperms policycoreutils
ERROR: chmod: changing permissions of '/etc/selinux/restorecond.conf' : Permission denied
--- restorecond.conf file is set to root|root with 0600

# rpm --setperms selinux-policy
ERROR: chmod: changing permissions of '/etc/selinux/config' : Permission denied
--- config file is set to root|root with 0644 

# rpm --setugids policycoreutils
ERRORs: chown: changing ownership of '/etc/selinux/restorecond.conf' : Permission Denied
chgrp: changing group of '/etc/selinux/restorecond.conf' : Permission denied

# rpm --setugids selinux-policy
ERRORs: chown: changing ownership of '/etc/selinux/config' : Permission Denied
chgrp: changing group of '/etc/selinux/config' : Permission denied
chown: changing ownership of '/etc/sysconfig/selinux' : Permission Denied
chgrp: changing group of '/etc/sysconfig/selinux' : Permission denied

Environment

  • Red Hat Enterprise Linux 5.10

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In