1

I run a new Linux web server ( Debian , Plesk ) I want to install some php application that need writeable folders, If I set the folder permission to 755 still web application can't write on folder, it just accept 777 mode, how can I configure server to accept 755 as a writeable folder? Thanks

EDIT : this thread help me to find a Plesk Add-On forum.parallels.com/showthread.php?t=106297

Ashian
  • 400
  • 1
  • 7
  • 24

3 Answers3

2

The web server will run under a different user/group combo than your own. As 755 means rwx for user and r-x for group and others (and in most cases the server will fall into the "other"), it makes sense that it cannot write to the folder. If you need it to write there, you must allow write to it.

There's also an option to use ACL (if the underlying filesystem supports it). Something like this:

[dado@liliput tmp]$ mkdir test
[dado@liliput tmp]$ getfacl test
# file: test
# owner: dado
# group: dado
user::rwx
group::rwx
other::r-x

[dado@liliput tmp]$ setfacl -m g:apache:rwx test
[dado@liliput tmp]$ getfacl test
# file: test
# owner: dado
# group: dado
user::rwx
group::rwx
group:apache:rwx
mask::rwx
other::r-x
[dado@liliput tmp]$ ll -d test
drwxrwxr-x+ 2 dado dado 4096 Pro 10 17:48 test

This will give write access to apache group even though it would have it via the "others" permission. Note the + sign after the permissions which denotes that ACL is set.

Also, if your host is running with SELinux enabled (I don't know if this is common for Debian, it is for RHEL clones), you can get permission problems even though it should be allowed (this is called file context)

2

You need to chown the directory you want to write to to the user that the webserver is running as. Type 'top' at the command line and see what user the webserver process is running as. Then, on the command line type sudo chown . That should make the directory writeable to your webserver with 755 permissions.

Brian John
  • 161
  • 1
  • 4
1

Seems, that web-server works under default user www-data and your files owner is another user. Therefore web-server can't write. In case your web-server is apache, there are serveral ways to defeat this problem: 1. use apache2-mpm-itk, that allows set different user for each virtualhost. 2. change default www-data to your user in /etc/apache2/env file and restart apache. 3. use acl and let www-data to write in your files.

And remember, that 777 is not good idea on web-server.

rush
  • 1,981
  • 2
  • 15
  • 23
  • He is using Plesk. So changing something by hand is not really a good idea. Plesk has often problems afterwards. The solution should therefore only involve changes he can do with Plesk. – Raffael Luthiger Dec 10 '11 at 16:39
  • I find this : http://forum.parallels.com/showthread.php?t=106297 but I don't check it – Ashian Dec 10 '11 at 16:51