You are here: Re: [PHP] Security - chmod 777 - PHP upload/write « PHP « IT news, forums, messages
Re: [PHP] Security - chmod 777 - PHP upload/write

Posted by Curt Zirzow on 10/04/38 11:05

* Thus wrote SED:
> Hi,
>
> Sometimes when I write a PHP-script and upload it to a ISP through password
> protected FTP, the only way to write data to a folder is to run chmod 777
> for that folder, I want to write (or save) a data to (e.g. file-upload,
> flat-file-database). However, if I do so, I have been told, everyone can
> write data to that file, which is a security risk. Is that true?

yes, chmod'ing a directory to 777 is not the wisest thing to do.

If security is a major concern you can lock down you directory you
wish to have your files stored in on a shared server with some
context like:

Assuming you have your files stored in:

/www/domain.com/htaccess ; the docroot
/www/domain.com/special ; locked down files
/www/domain.com/ ; your ftp root

via ftp make a directory:
/www/domain.com/special/store/

chmod 777 /special/store

Then make a php script that does something like:

mkdir('/www/domain.com/special/store/files/');
chmod('/www/domain.com/special/store/files', 0700);

execute the script with the browser.


Now back in ftp:
chmod 755 /special/store


And wala.. your /www/domain.com/special/store/files is secure as
long as open_basedir is in effect.


HTH,


Curt
--
Quoth the Raven, "Nevermore."

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация