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/
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 Jul 26 '13 at 16:36newgrp
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-- Jul 26 '13 at 16:44