1

I have a a Joomla CMS which is a PHP script that needs to write new files and directories, I changed the umask value and I ended up re-installing the system :-s.

Can you please guide me step by step on how to set the default permissions for uploaded/new files in the www directory "which where the website is"

I'm using apache2.2 on a Ubuntu 10.4 server.

Thank you all in advance.

Sakhar
  • 11
  • 1
  • The default owner and group for Apache in Ubuntu is "www-data". What is the user you're uploading files with? – Chris Ting May 25 '11 at 05:25
  • I already changed the www-data default permissions but it didn't work. Maybe it was not the right way to do it, can you please explain how to change the default permissions for www-data? and how to make sure that my php script is using the www-data? – Sakhar May 25 '11 at 05:29
  • To recap your question, you need your PHP script to write new files and directories. Is this correct? If so, what are the permissions on /var/www? Who is the owner and group of /var/www? I suspect that /var/www is owned by root, and only root has write privileges to that directory. – Chris Ting May 25 '11 at 05:37
  • Actually I changed the www directory location from /var/www to home/media/www so I think it's owned by the user "in my case" media. in my web hosting which it's by godaddy when I upload/create files or directories it will be 775 by default so I'm pretty sure there is a way to do it. – Sakhar May 25 '11 at 06:25
  • Please edit your question to reflect your changes. I suggest you add the owner/group settings and the current permissions of the directory you want to write to. Also, check your logs to see what errors PHP is giving. You can find where your error log is by checking your Apache virtual host settings (no setting means it's in the default Apache error_log file). – Chris Ting May 25 '11 at 13:54

1 Answers1

0

Can you tell us what the current permissoins are, and what you'd like them to be? Not sure if you're trying to change the rwx permissions or user/group ownership settings.

opsguy
  • 801
  • 1
  • 5
  • 12
  • Right now when the default permissions for files are 644 and directories is 755. I want it to be 775 for both files and directories. – Sakhar May 25 '11 at 05:24
  • 1
    I've looked around, and don't think its possible to create files that are by default executable. Your only option is going to be to `chmod ug+rwx` the file after its uploaded via some post-upload script. The default permissions for new files are 666 minus the umask, and I can't find anything that talks about changing the default 666 value. – opsguy May 25 '11 at 06:07