views:

39

answers:

1

Hi,

I have a default installation of joomla under ubuntu 10.04. I have also changed the permissions of index.php of template(apache user with read write permissions), so that I can change the index.php from administrator screen. Everything works fine till here.

But now when I change the file from admin screen and save the file, its changing the file permission and removing the write permission from the file. It does saves the changes though.

Now as the write permissions are removed, when I try to install the template it gives me error. So again I have to manually set the write permission for the apache user on index.php and install the template again, then it runs good.

Does anyone know if joomla is changing the file permissions, and any idea how I can tackle this problem.

Thanks, Tanmay

+2  A: 

You're possibly affected by a umask setting. Put umask(0133); in your configuration file (or anywhere you want, just make sure it comes before making files).

Background information:

  • r (read) has a value of 4 (binary value: 100)
  • w (write) has a value of 2 (binary value: 010)
  • x (execute) has a value of 1 (binary value: 001)

These permissions can be granted to the owner, group and everyone else ('other').

When a file is created in PHP, it adds the 666 to it by default. From this number, the umask value is removed using bitwise AND. It looks like you've a umask of 0333. The best way to show what happens is by demonstrating it:

PHP adds: rw-rw-rw- 0666
umask   : -wx-wx-wx 0333
result  : r--r--r-- 0444

And if you're using umask 0133:

PHP adds: rw-rw-rw- 0666
umask   : --x-wx-wx 0133
result  : rw-r--r-- 0644
Lekensteyn
Thanks Lekensteyn. I'll try this and update in few mins.
jtanmay

related questions