Owner root gets "Operation not permitted" on chmod and setfacl

Latest response

I can't figure this riddle out. su as "root" - .htaccess is owned by "root". But can neither chmod not setfacl. File is read-only to me (can't even rename it). I can create an .htaccess2 file in that same directory and manipulate it freely.

[root@mgs-11 BadgleyMischka]# ls -la --group-directories-first --lcontext .htaccess
-rw-r--r--. 1 unconfined_u:object_r:httpd_sys_content_t:s0 root root 219 Mar  1  2013 .htaccess

[root@mgs-11 BadgleyMischka]# getfacl .htaccess
# file: .htaccess
# owner: root
# group: root
user::rw-
group::r--
other::r--

[root@mgs-11 BadgleyMischka]# chmod 777 .htaccess
chmod: changing permissions of `.htaccess': Operation not permitted

[root@mgs-11 BadgleyMischka]# setfacl  -m g:Site_Developers:rwx .htaccess
setfacl: .htaccess: Operation not permitted

Responses

Hello Andy,

Perhaps the immutable flag was set. See more in this article:
What can prevent root from modifying or deleting a file when SELinux is disabled?

Best of luck,

Marc

Another idea is that the filesystem could be mounted read only.
The mount command without any arguments will show a list of mounted filesystems with a list of filesystems in parentheses. rw indicates that the filesystem is mounted read-write, ro indicates read-only.

Marc, thank you. I had been looking for some sort of "attrb" command - but in one hour search of reasons for that error message never encounterd any mention of attributes/extended attributes as possible cause.

As you suspected, when I found the:

lsattr

command, the file had the "i" attribute - and a simple

chattr

resolved the situation.

Thanks for the pointer!

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.