Chmod not working on /var/www/

0

I am running an Ubuntu 11.10 x86 VPS. I have given a user sudo privileges, and for some reason I cannot recursively chmod /var/www/. I am running Nginx with php-fpm, although that shouldn't matter. Also running DenyHosts, which also shouldn't matter.

Here are the commands I run

sudo usermod -a -G www-data <my_user>
sudo chgrp -R www-data /var/www
sudo chmod -R g+w /var/www
sudo find /var/www -type d -exec chmod 2775 {} \;
sudo find /var/www -type f -exec chmod ug+rw {} \;

Commands source: How can I give write-access of a folder to all users in linux?

Another strange note is that if I login to root and run the same commands, it still won't recursively chmod. I can also chmod in my own home directory.

All suggestions would be appreciated.

austin@ubuntu:/var/www$ df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/simfs           157286400   2331852 154954548   2% /

austin@ubuntu:~$ stat /var/www
  File: '/var/www'
  Size: 4096        Blocks: 8          IO Block: 4096   directory
Device: b5h/181d    Inode: 22839436    Links: 4
Access: (2775/drwxrwsr-x)  Uid: (   33/www-data)   Gid: (   33/www-data)
Access: 2013-07-26 20:17:25.000000000 +0400
Modify: 2013-07-26 19:52:41.000000000 +0400
Change: 2013-07-26 20:17:19.000000000 +0400

The /var/www/ directory is setup like this:

/var/www/somewebsite.com/
/var/www/sub.somewebsite.com/

Austin K

Posted 2013-07-26T16:29:38.760

Reputation: 1

what is the output of df? could /var/www be mounted from somewhere else? – johnshen64 – 2013-07-26T16:36:45.350

1

Please edit your post to include the output of stat /var/www, and the output from the chmod command. (I'm guessing /var/www might be a symlink.) Also, as an aside, there is no Ubuntu 11.0; you probably mean Ubuntu 11.04, which is something quite different. 11.04 was also EOL'd (End Of Life) over half a year ago, in October 2012 and has not received any updates, including security updates, since then; you should strongly consider upgrading.

– a CVn – 2013-07-26T16:36:56.643

Tell your user to checkout the newgrp command. After moving to the www-data group he can write to that directories/files. I don't think you need to set the sgid bit. – ott-- – 2013-07-26T16:44:40.960

Added the edits your requested. @MichaelKjörling the OS was a typo. I meant 11.10 x86. – Austin K – 2013-07-26T16:45:09.590

1You say "it isn't working", how is it not working? What is the error? What is the result? – Der Hochstapler – 2013-07-26T16:47:04.877

There is no error. The command appears to run properly, but the result remains the same. All /var/www/ files are 644 permissions before and after that. – Austin K – 2013-07-26T16:47:52.240

Provide the output of stat /var/www/somedir/somefile.foo that did not chmod as you claim. You also state there are no errors shown at all? The stat /var/www looks good to me in respect of the commands run. – Darryl Miles – 2013-07-26T23:07:06.873

No answers