Reputation: 57
I'm currently facing a problem at work as we used Wordpress to create the company's website, and the files that are being generated are owned by user www-data and group www-data while my account is from the users-ftp
This leads me with several problems for managing files as my FTP account doesn´t have rights (also for Wordpress which conflicts plugins management and cache plugins)
From my point of view the problem is from the hosting, which weren't able to fix the issue. However at work I'm told that it could be a bad Wordpress installation.
Is there a way to force Wordpress to create new files under my FTP account instead of www-data? (or somehow explain the hosting service how to fix this)
About the options available to me, it is just an FTP account (no .php files) and a table at PHPMyAdmin.
Upvotes: 0
Views: 480
Reputation: 2359
www-data
is the user web servers use (Apache, nginx, etc...). So when you create files via WordPress, you are just inputting the information into a GUI and your web server is actually creating the files, therefore using www-data to create them.
There are a couple of solutions here:
You could do:
sudo chown -R users-ftp:www-data /var/www/html/path-to-your-file // Or whatever your path to your file is
sudo chmod -R g+s /var/www/html/path-to-your-file
The first command changes the user and group, respectively, and the second command adds an "s" attribute which will keep new files and directories within your directory that has the same group permissions. Basically it would allow you (users-ftp) to edit and upload the files via FTP.
You could also add your user to the www-data
group:
sudo adduser {your-user} www-data
to allow your web server to write to it (if it needs to).
Another solution would be to change www-data and have your web server run as another user:
sudo nano /etc/apache2/envvars
Then inside the file:
export APACHE_RUN_USER=your-user
export APACHE_RUN_GROUP=your-user-group
Obviously, you want to restart your web server:
sudo service apache2 restart // Or another similar command for nginx, etc...
Upvotes: 1