Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
Did you try 775? With Plesk most of the permissions are handled with the group and not with the user. –  Raffael Luthiger Dec 10 '11 at 16:37
    
775 doesn't accept. it just accept 777 –  Ashian Dec 10 '11 at 16:50
add comment

3 Answers 3

up vote 2 down vote accepted

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.

share|improve this answer
add comment

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)

share|improve this answer
add comment

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.

share|improve this answer
    
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 : forum.parallels.com/showthread.php?t=106297 but I don't check it –  Ashian Dec 10 '11 at 16:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.