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.

Possible Duplicate:
What are the best linux permissions to use for my website?

When I trying upload file with PHP to a folder that folder should have 777 permission, but this is a security risk, I want set 755 for folder permission but in this permission PHP cannot upload files.

What should I do ?

Server: Linux CentOS

Control Panel : Kloxo

Root Access : Yes

share|improve this question

marked as duplicate by Michael Hampton, Magellan, Ward, voretaq7 Dec 7 '12 at 3:12

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

You can simply change the owner of the upload folder to be apache user using:

$ sudo chown apache_user /path/to/upload/folder

Of course, you need to know the user your web server is running as.

If you want to share the folder between multiple users, you can change the group and grant the group the appropriate permissions.

share|improve this answer
    
Thank you, this change solved my problem but when I creating a new folder with FTP the owner is user:user so I should change it from SSH again, is there any way to solve this problem for ever ? –  MajAfy Dec 6 '12 at 8:17

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