Why are apache files created in Wordpress being generated?

I am getting this problem now and then when I use the FTP account provided by the host and use them in Wordpress FTP. But for some reason, when updating themes, for example, a new theme is created under the apache / apache name, not the user / psacln user / group name. So at this point, I cannot delete or do anything with these files, since I am under the psacln group.

I would like to know more about why this might be happening in order to avoid this problem - any suggestions are appreciated!

Thanks in advance.

+3


source to share


2 answers


When you upload files using the wordpess admin page (like a theme), the httpd process running as the apache user actually creates them on your system, so they are owned by the apache user. I suggest the following options:

  • Add yourself and apache to a new group called "wordpress"
  • Use to change the group ownership of your Wordpress to a new group.
  • Use sgid permission bit and write group permissions to all directories in wordpress docroot.

Setting the sgid bit will make all files added to the directory the same group owner.

Assuming you've added yourself and apache to the same group, here's the linux commands to set up directories to ensure that files are made writable by everyone in the wordpress group:



chown -R :wordpress /path/to/wordpress/docroot/ 
chmod  -R g+w /path/to/wordpress/docroot/
find  /path/to/wordpress/docroot/ -type d -print | while read i; do SAVEIFS=$IFS; IFS=$(echo -en "\n\b");chmod g+s $i; IFS=$SAVEIFS; done

      

Additional information you may need:

If you see apache creating files with group permissions without writing, you may need to change the default umask for apache user to create new files. By default it should be owner and group rights, but I know that some accounts (like the root user) have a default read-only group umask set.

+3


source


since the apache child workers are running the apache userid and a "normal user" on unix cannot force files to be owned by some other user. Only the root account can "give away" ownership.

Why? It would be trivial for a normal user to make the file owned by root or owned by another user. If a given system operates with user quotas, it will allow the user to completely undermine the quotas or deny someone else access by “giving” them a bunch of huge files and exceeding that user quota.



If you need access to these files, regardless of unix ownership, you can look into using POSIX acls, which exist above / beyond unix permissions.

0


source







All Articles