Is there a way to get the wordpress java uploader to save the pictures as a different user?
this is a problem – when using wp uploader on some servers it changes the owner
To make sure the webserver is the owner I use “chown -R www-data:www-data /var/www”
also, I have used this guide in the past
http://hereshowi.com/wordpress/fix-wordpress-permissions-on-mediatemple-dv-server
it works for any apache server
Thread Starter
cofcc
(@cofcc)
I get invalid user error when I tried that command. Can you briefly explain what this command is doing?
chown -R www-data:www-data /var/www
Thanks,
Replying to this post as it is still quite prominent on Google searches.
You need to remember a few things when running the chown command in this context:
You must specify the correct user/group
chown stands for “change ownership” – this command will change the owner of a file and the group which the file belongs to. Samuel B uses www-data because his Apache webserver is running under the user www-data. I believe some versions of plesk run as the user apache. A simple way of finding this out is running:
cat /etc/passwd
You will see a user name www-data or apache. Use that in the chown command.
Run chown as superuser
Changing permissions/ownership of files is something a superuser (root) must do. On some systems you can run sudo chown ... or similar, but on a lot of Plesk installations your normal user account won’t be in the sudoers file. You will have been given a root account completed with password – ssh to the server and log in as root then run that command.
breakdown of chown
chown is simply a command on the Linux command line. As with all commands, you can read a manual page by typing man command – i.e. man chown. That said, the chown command is simple enough…
chown -R www-data:www-data /var/www
chown – the name of the command
-R – recursive – meaning run this command on all files including those inside folders (and subequent folders) until all are chowned
www-data:www-data – On the left of the colon is a username and on the right is the groupname. To set just a username and or groupname just omit the one you don’t want.
/var/www – the file/folder to chown. This can be either a file or folder. Remember if you specify a folder without the -R option it will only chown that folder – the contents of that folder will remain the same.