View Full Version : mkdir ftp & linux

03-10-2010, 02:22 AM
Hello everyone, I'm trying to finish setting up my linux server and everything is going well, apache, php, mysql, and ftp, except php and ftp dont like each other, when i create a folder in php using mkdir it makes it fine but sets the owners to apache when the ftp user is vsftpd and requires that to be able to edit or delete them or i need to set the permissions to allow anyone to access the files to be able to read and write but cannot get it to work right, does anyone have any ideas?

03-10-2010, 04:55 AM
Hello. Sounds like you got some umask work to do - but first the easy solution.

You should be able to call PHP functions chmod (http://php.net/manual/en/function.chmod.php) and chown (http://www.php.net/manual/en/function.chown.php) immediately after the creation of the directory.

Make sure PHP security is not interfering via safe_mode (http://www.php.net/manual/en/features.safe-mode.php) or open_basedir.

You can use chmod to make the directory world-writable (if that's not a security concern) or change the directory owner to vsftpd.

An Apache solution is to modify the default umask (http://www.cyberciti.biz/tips/understanding-linux-unix-umask-value-usage.html). This is done by adding the following line to the envvars files for Apache (location depends on your Linux distribution):

umask 0000

Effectively setting the default permissions for new files/folders to world-writable (again - if this is not a security concern in your environment).

Let me know if you need more specifics.

03-10-2010, 07:11 PM
thanks alot for the quick response, once i get home i will try this out, thanks alot