PDA

View Full Version : CHMOD settings?


Kuma11
10-8-05, 01:25 PM
What should the CHMOD settings be for a 'standard' html only web site? I thought I understood CHMOD, but it's got me confused. I'm on ftp02 (cluster 02), use WS-FTP, and, from htdocs' down everything is currently set to:
Owner: R W X
Group: R - X
Other: R - X
(occassionally when I log-on I find it's 'changed' itself, to 'new' random settings (???):

If I go into a sub-directory, any sub-directory, and do a CHMOD then whatever I change takes effect on EVERY directory, including htdocs! This seems strange. So, how should I set htdocs, then how can I change a sub-directory to a different setting without it effecting every other directory?

I also noticed when it's set it to:
Owner: R W X
Group: R
Other: R
My web site stops functioning with a 404 error... :confused: Why?

ON EDIT: I just initiated an FTP session and the CHMOD settings have changed all by themselves to:

Owner: R W X
Group: R
Other: R

When I tried to access my site from a brower I get:

Sorry, this site is temporarily unavailable
403 Forbidden by Web Configuration

The changes to CHMOD occured by themselves. I wasn't logged in!

Any idea WHY this is happening?

stevel
10-8-05, 04:31 PM
There could be a problem with what you're using to change the protections - is this the "site manager" tool from OPS?

The normal protection is 755, which is what you show in the first part of your post.

Kuma11
10-8-05, 04:51 PM
No, I was using a 'utility' internal to WS-FTP. Forgot about the Site Manager. Let me fix it there, and thanks.

Croc Hunter
10-9-05, 12:27 AM
Folders should be 755 but your html and most files should be 644 make .htaccess 640
WS-FTP is problematic. OPS File Manager seems reliable or try FileZilla or SmartFTP (they're free FTP programs).

Kuma11
10-9-05, 10:06 AM
Yeah! I used the Ops Site Manager and now all is well. Guess I'll just use WS-FTP for uploading, it does that just fine. Files and directories are now back to normal (755 and 644) and everything works again. PowWeb worked just fine... the operator, on the other hand :eek: !!!! Thanks for the help!

lardconcepts
10-9-05, 10:33 AM
Let's say you had a site or app which has lots of files and directories, which all needed setting properly. For example, Zen, or Gallery or whatever. Make something like this, call it "lockdown.sh", then call it via a simple php script (tucked safely away somewhere).

#!/bin/sh
chmod -R 755 ./
find ./ -type f -exec chmod 644 {} \;
chmod -R 777 ./cache
chmod -R 777 ./temp
chmod 400 ./includes/configure.php
chmod 400 ./admin/includes/configure.php

And that's it. Just modify as needed - the important bits are the first 3 lines, leave them as is. The last four lines are specific to Zen Cart, gallery will be different, PHPNuke different again. But is sure saves a lot of mucking about!

extras
10-9-05, 10:44 AM
chmod -R 777 ./cache
chmod -R 777 ./temp

Most probably, you don't want to use 777.
700 is enough for the directory only accessed from php/cgi (and no html or php documents in it)

lardconcepts
10-9-05, 03:34 PM
chmod -R 777 ./cache
chmod -R 777 ./temp

Most probably, you don't want to use 777.
700 is enough for the directory only accessed from php/cgi (and no html or php documents in it)

Quite - but in this case, for some reason the application demands 777 and won't work without it, so these two folder over-ride the general settings, but you are right to point out that unless software requires, then 777 is very bad!

Croc Hunter
10-9-05, 11:12 PM
Never chmod to 777 or 666 here it's a security risk!

Generally when told 777 you'll find 755 is sufficient. If it demands 777 I would not install it as the rest of the code is probably just as poorly written. Also just to note *sometimes when you chmod to 400 here the files seems to lock or get stuck on 400 and you can't change it again so be sure if you really want 400.