3

Ok, I kind of thought I understood Linux permissions and then I encountered this one.

I am running Ubuntu 14.04 LTS in a virtualbox on my Windows 7 pro laptop. All udpates are applied to windows, virtualbox and ubuntu.

I have used the virtualmin 4.12 gpl install script to set up virtual hosting - again, all updates have been applied.

I want to edit the php5.fcgi file in /home/staging/fcgi-bin to extend the timeout values controlling the php5 script executions. when using ls -l the directory /home/staging/fcgi-bin is owned by staging:staging and permissions are drwxr-xr-x and the file php5.fcgi is owned by staging:staging with permissions -rwxr-xr-x. WHen looking at them via the files gui they both show up as owned by "Me" and grouped in staging with the same permissions that ls -l shows. Through files the directory does not show any lock but the php5.fcgi has a small lock icon overlaying the file icon.

Ok, I can open, read and find the file, I believe that I can execute it as that is how my php scripts are run. However, I cannot save any changes through gedit or nano even when I use sudo to run them. gedit always shows the save icon as greyed out/not available. nano reads the file in and allows me to modify it but when I try to save it I get a permission denied error.

I tried to rename and change the ownership and permissions but mv, sudo mv, chown, chmod, sudo chown and sudo chmod all fail with operation not allowed.

When I look to see if the file is opened with lsof | grep "php" I get nothing listed and I think this means the file is not opened.

So I am baffled and really could use some help. I do not understand how the file gets locked if it is not open and I do not understand why I cannot modify the file in any manner if I am the owner of the file and have rwx permission.

1 Answer 1

4

If Linux permissions were not complicated enough, I just learned about extended attributes. Turns out there is this thing called an immutable attribute. Using lsattr php5.fcgi shows the i(mmutable) attribute is set. Using chattr -i php5.fcgi allowed me to save modifications then chattr +i php5.fcgi to restore the immutable attribute.

Who knew!

2
  • Also look up ACLs, just for fun.
    – muru
    Jan 7, 2015 at 21:47
  • Oh you saved me a lot of time! Correct answer. But I'll never ever use chattr +i php5.fcgi to restore this problem again! Jun 27, 2018 at 1:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .