Web Hosting Talk







View Full Version : .htaccess security question? (chmod 666)


MGCJerry
06-26-2004, 03:16 AM
I have a little php/MySQL script running that edits my .htaccess file, so my .htaccess has to have write permissions (chmod 666). What are the security issues with doing this?

My htaccess is located in my account root folder ( / ), and not my web root ( /public_html ).

Thanks in advance.

LP-Trel
06-26-2004, 04:29 AM
If you run PHP as nobody or the Apache user (as mod_php) giving write permissions is a potential vunerability. If you use open_basedir it reduces the risk.

Bashar
06-26-2004, 04:34 AM
apache blocks accessing /.htaccess files.

but local users might be able to read that file by cat ~login/path/to/.htaccess and even writing to it

i'd suggest chmoding it to 660 and changing the group to nobody so only apache can write to it.

although its not possible to change ownership to nobody except by a script runs under nobody user.

MGCJerry
06-26-2004, 05:47 AM
Thanks for the responses Trel, and Bashar.

I'm not sure what Apache runs under. I'd have to ask my host. I also dont think anyone has shell access to the server, so me changing groups is not possible.

So, having the file in the location I'm in makes it safe from the "web", but it could be read by somebody locally?

LP-Trel
06-26-2004, 06:03 AM
Read up on the system, shell_exec, etcetera functions of PHP. ;)

MGCJerry
06-26-2004, 06:07 AM
Thankfully, my host has those disabled... Or the last that I heard he did. ;)