Chmod 777 - Is it a Risk When Installing PHP Scripts?

Often when setting up PHP scripts on web hostinghacker exploit it if they got in?
accounts you will see the requirement to set some>A. When a hacker gets in and starts causing
files and directories to Chmod 777. This meanstrouble not much will stop them. Even with the file
everyone can read, write and execute this items. Onpermissions as strict as possible other opportunities
the surface this looks like a security risk but with awould be exploited, like databases will be wide open.
properly configured server this is security risk isSo, yeah... you can ensure some files that are not
eliminated.change or deleted, but not all.
Q. Should EVERYTHING be chmod 777 then whenQ. Is it likely a hacker would get into my server to
installing PHP scripts?access the mysql database?
A. Not really. Just the required directories, and all theA. Yes as likely just as much as getting in to edit
files and directories inside them. Again it won't effectfiles, by editing your files the hacker can change
security if you do, so long as the server configurationthings like what is displayed on your web pages, buy
has a normal security configuration.normally stored in the mysql database are items like
Q. Access by "Owner," "Group," and "Everyone." aree-mail addresses and passwords that can be much
what the numbers mean, so can anyone change filesmore valuable in terms of cash. A database is chmod
set to 777 because they are writable to everyone?777 at all times when you think about it.
A. Um, on the surface, yes. But, looking deeper theQ. Can MySQL permissions be used to secure it form
person must first get access to your server and beintrusion as well? if I make it so they users can not
able to view the file to do that. They additionallydelete what will happen?
need access to the files directory, and the directoriesA. Most scripts will not work with limited settings like
directory that file located all the way up the pointthat. Scripts need to be able to delete content at
they try to access your files. Reasonably you willtimes. If the script can delete, so can a hacker. So
have a directory (like your user name) which is notthe key is keeping them out of the server before
chmod 777. This is normally set to chmod 111 by thethis point is the only real solution.
host at account set up.Q. Still my host does not want me setting things to
Q. Would it be safer not to use chmod 777? Could achmod 777 because they say it is not safe?