I am occasionally having problems with file and directory permissions changing, seemingly on their own. Usually I just CHMOD it and overwrite it with the proper owner. However, I am at the point now where I cannot even upload a file in FTP to the /web/ directory from the site's admin account! (web7_admin) Can you teach me how to properly set the file permissions to this account? I have NO idea how they got changed - I didn't change anything. I don't want to CHMOD my /web/ directory to 777. Thanks!
Code: total 289812 drwxrwxrwx 18 1000 users 4096 Feb 29 05:37 . drwxr-xr-x 10 web7_admin web7 4096 Sep 30 01:57 .. drwxrwxrwx 9 1000 users 4096 Feb 28 04:22 administrator drwxrwxrwx 5 509 509 4096 Aug 31 18:34 cache -rwxr-xr-x 1 web7_admin web7 104874 Feb 21 08:34 CHANGELOG.php drwxrwxrwx 21 1000 users 4096 Feb 28 04:11 components -rwxrwxrwx 1 509 509 2716 Feb 15 22:18 configuration.php -rwxrwxrwx 1 1010 1010 4372 Jul 21 2007 configuration.php-dist -rwxrwxrwx 1 509 509 3429 Jun 5 2006 COPYRIGHT.php drwxrwxrwx 2 509 509 16384 Aug 31 18:34 ebay drwxrwxrwx 2 509 509 4096 Aug 31 18:34 editor drwxrwxrwx 2 web7_admin web7 4096 Aug 31 10:56 error -rwxrwxrwx 1 1010 1010 3745 Jul 21 2007 globals.php -rwxrwxrwx 1 509 509 0 Feb 6 07:45 googlee65eefbe29bebfe6.html drwxrwxrwx 3 1010 1010 12288 Feb 28 04:22 help -rwxrwxrwx 1 root root 4826 Aug 31 18:57 .htaccess -rwxrwxrwx 1 root root 4826 Oct 22 06:26 htaccess.bak -rwxrwxrwx 1 509 509 4831 Aug 31 18:45 htaccess.txt drwxrwxrwx 6 509 509 36864 Aug 31 18:34 images drwxrwxrwx 10 1010 1010 4096 Feb 28 04:22 includes -rwxr-xr-x 1 web7_admin web7 5216 Feb 21 08:34 index2.php -rwxr-xr-x 1 web7_admin web7 8481 Feb 21 08:34 index.php -rwxrwxrwx 1 509 509 4376 Dec 24 2006 INSTALL.php drwxrwxrwx 2 509 509 4096 Aug 31 18:34 language -rwxrwxrwx 1 509 509 17977 Jun 5 2006 LICENSE.php -rwxrwxrwx 1 509 509 561500 Jun 22 2006 logos.zip -rwxrwxrwx 1 509 509 710 Jun 5 2006 mainbody.php drwxrwxrwx 7 1010 1010 4096 Jul 20 2007 mambots drwxrwxrwx 2 509 509 4096 Feb 28 04:11 media drwxrwxrwx 6 1000 users 4096 Feb 28 04:22 modules -rwxrwxrwx 1 509 509 2474 Jun 5 2006 offlinebar.php -rwxrwxrwx 1 509 509 4929 Dec 24 2006 offline.php -rwxrwxrwx 1 509 509 709 Jun 5 2006 pathway.php -rwxrwxrwx 1 1000 users 752 Jan 30 04:55 README.patch.txt -rwxrwxrwx 1 509 509 286 Jun 5 2006 robots.txt -rwxrwxrwx 1 509 509 199 Jun 27 2006 seal.html drwxrwxrwx 16 web7_admin web7 4096 Feb 19 2006 squirrelmail drwxrwxrwx 2 1000 users 4096 Feb 2 04:15 stats drwxrwxrwx 7 509 509 4096 Feb 28 04:22 templates -rwxrwxrwx 1 root root 4771344 Feb 28 04:01 web7_db1.sql -rwxrwxrwx 1 root root 279734 Feb 28 04:01 web7_db2.sql -rwxrwxrwx 1 web7_admin web7 17 Feb 10 09:54 y_key_4c4376b68e0d4684.html
Should I do this recursively? How can I prevent this from happening again? It seems to happen on all the websites on the server.
Depends on your application. If there are files or diretories that the Apache user must have write permissions on, then no, otherwise yes. Please check if there's a cron job or some other process that's changing the permissions.