sweede wrote:Brimstone wrote: In fact, only Apache needs to be able to write to the files.
You are correct, Apache needs to be able to write the files.
Unix permissions are octal codes there are three types, read write execute.
...
this is why you need 777.
I laughed, I cried...
You are -so- wrong that I can't help by laugh myself silly.
If you hosting service or whatever has told you this, move to a company that cares about your security, cuz this one don't.
'What you need' as you put it is that the file be writable, not any specific permissions. 0777 always guarantees this, but it also always guarantees that you are insecure. Less permissions work in many proper setups.
Allow me to express myself in Perl, it should be easy for everyone to read:
- Code: Select all
#Assume needed use statements.
my $stat = stat('/dir/where/I/am/installed');
if ($UID == $stat->uid) {
# Permissions should be 0700/0600;
die if $stat->mode & 0700;
} elsif ($GID == $stat->gid) {
# Permissions should be 0770/0660;
die if $stat->mode & 0770;
} else {
warn "You have a crap ISP, move!";
}
As for your belief that Apache means all files have to be world writable, I suggest you either use a box you own (like I do) where you can just chown everything to apache directly, or get a reputible ISP that uses Apache's suexec features. (Dreamhost for example.)
http://wiki.dreamhost.com/index.php/Suexec
http://faq.siteground.com/faq/file-permissions.html
ISPs, by and large, do not like having thousands of their customers taken over because they all followed some instructions to chmod everything in sight to 777. It's a very expensive cleanup when a thousand websites suddenly start hosting phishing pages or keyloggers.
Oh, and if you somehow misunderstood my initial post to imply that I am not versed in Unix security or Apache, I should let you know I was on the SSH2 IETF task force and have been a Unix user and sysadmin for about 15 years now. I'm currently responsible for writing software to secure what are literally some of the largest data centers in existence, upwards of 8,000 *nix boxes at a single site.
So, please, no attempts at remedial lessons for me, OK?