linuxapachepermissionswebserverpureftpd

Permissions - Apache and Pure-FTPd - How to set?


I have a big doubt how to setup Apache and Pure-FTPd. I don't know how set folder permissions and secure users to not access other folders outsite their home directory.

My scenario:

I did:

chown apache:apache /sites -R

To create an user on Pure-FTPd:

pure-pw -u myuser -d /sites/onesite -u ftpuser -g ftpusers
pure-pw mkdb

This way I can connect to a FTP account but cannot transfer (permission denied) or delete files.

I can set all /sites to 777 but I know this is not correct. I want to know the correct way, so users can upload/delete files, Apache can read/write files in each website, and if a user upload something to try read outside the /sites directory he gets an error.

Please, help me to secure my webserver using Apache and Pure-DB, plus Linux permissions.

Thank you!

Roger


Not sure if this is correct: I've created the FTP user using "apache:apache"

pure-pw -u myuser -d /sites/onesite -u apache -g apache
pure-pw mkdb

and set:

chmod 770 /sites -R

So everything runs on apache:apache.


Solution

  • Same issue here. I solved it lowering /etc/pure-ftpd/conf/MinUID to my www-data UID number. Though I'd like to know if there is a better solution.