chcon command returns "failed to change context, invalid argument" error
Environment
- Red Hat Enterprise Linux 5
- Red Hat Enterprise Linux 6
- selinux-policy
Issue
chcon
command returns "failed to change context, invalid argument" error
# file /root/unique.options
unique.options: ASCII text
# chcon -u unconfined_u -t admin_home_t /root/unique.options
/usr/bin/chcon: failed to change context of /root/unique options to unconfined_u:object_r:admin_home_t:s0: invalid argument
Resolution
- If the
SELinux
type is invalid or not available in the policy,chcon
returns the above error. - Check if the type is available in the policy.
[root@localhost ~]# semanage fcontext -l | grep admin_home_t
- On RHEL5 systems, we don't have
admin_home_t
type available. - Replace
admin_home_t
type with the valid SELinux type.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments