Home > Software design >  how to allow for Apache to read/write to user home directory?
how to allow for Apache to read/write to user home directory?

Time:12-10

I want to allow for Apache to upload files to user home directory /homw/username/upload_files which is outside the webserver root /var/www/website/

my apache server is currently running under user "www-data". I changed the group owner of the target folder /homw/username/upload_files to www-data , and changed the permission to rwx

drwxrwxrwx 2 www-data www-data 6 Dec 6 09:46 upload_files

However, I am not able to figure out how to allow for apache to upload files to user's home directory.

CodePudding user response:

I suggest one of the following approaches and both working with me.

1- Change Ownership of full path /home/username/upload_files to apache user www-data and give owner-write permission. sudo chown -R www-data:www-data /homw/username/upload_files

please note that this will change owner of home directory including all entire folders to www-data

2- So, I prefer to move the upload_files to root directory and change the owner to www-data

sudo chown -R www-data:www-data /upload_files

  • Related