Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On my Debian server I am running Apache. Today I found that I am unable to create files in all of the website directories. So for example I have /var/www/testsite. I change to that directory.

Then the following command cp index.php test results in cp: cannot create regular file test': Invalid argument'.

Both the normal and root users are unable to create a file. Other commands souch as 'echo hello > test' fail as well.

However, mkdir test succeeds. So I can create directories, but not files.

The directory permissions are 755, same as all the other directories. I can create files in the other directories on the system.

I ran lsattr . but am not sure what I was looking at. The result was

--------------------- ./testsite

Any ideas?

share|improve this question
    
Is it possible that your filesystem somehow got mounted read only? I have seen that too many times on Ubuntu, for sure running on older hardware. (I have seen it sometimes on Debian because it is more stable than Ubuntu 12.04.) "Rebooting and the problem went away" sounds like the first clue in my opinion. –  Mike Lipscomb Sep 11 '12 at 10:32
add comment

1 Answer

This is a longshot, but if you mounted your htdocs in userspace, for example with fuse or fusermount, the contents cannot be touched by root.

I had similar issues with mounting ecryptfs htdocs into /var/www at logon just because I wanted to encrypt everything externally and mount it for development purposes when required.

Use the user that mounted the directory for editing, make sure that user is in the group used by your webserver, e.g. www-data, and have that group with the proper group-permissions set for the mounted files.

share|improve this answer
    
The directories are not separately mounted. They are part of the root filesystem. –  jriggs Feb 14 '12 at 14:57
    
That's weird then, now I am equally curious as you. –  Redsandro Feb 15 '12 at 5:32
    
Thanks. I didn't figure it out. I just ended up rebooting and the problem went away. –  jriggs Feb 15 '12 at 5:40
    
Maybe you changed something about users or groups. When you do that, you need to log out and in again until the changes take. Or when it concerns root, you cannot log out so a reboot is required. If you didn't change anything, it will remain one of those mysteries. –  Redsandro Feb 15 '12 at 9:41
    
I don't see how a change to users or groups, could cause a cp to fail in a directory, while mkdir works. My best guess is that there was some filesystem corruption, and the reboot ran fsck. However, /var/log/fsck/checkfs did not show anything. –  jriggs Feb 15 '12 at 14:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.