2

I have a site which has a folder for google sitemaps. Recently I've been receiving the following error sent to me

Sitemap generate warnings:
File "sitemap.xml" cannot be saved. Please, make sure the directory "/var/www/vhosts/frrakns.com/sitemaps/en/" is writeable by web server.

Using ls -ld it shows the following owner and permissions

drwxrwxr-x 2 www-data www-data 4096 Jul  3 22:04 /var/www/vhosts/frrakns.com/sitemaps/en/

So I generally take this to mean the folder is owned by apache and both owner and group has write permissions. Where am I going wrong?

  • Ah. So checking up the directory structure, they're all www-data:www-data until /var/www/vhosts, which is www-data:root. I take it that by changing the sitemaps folder to www-data:root this will work – Michael Aug 28 '15 at 7:35
  • @Rinzwind Of course www-data doesn't need write access to the directories above, only the execute (x) right is necessary there. But what user runs php? Is it included in apache or externally? – Jakob Lenfers Aug 28 '15 at 7:36
  • www-data runs php. (just used echo exec('whoami');) – Michael Aug 28 '15 at 7:38
  • You can open a shell as www-data (sudo su - www-data -s /bin/bash) and try to create a file there to make sure you can access the directory and have write access. If that doesn't help, I would think it has nothing to do with your rights. The error sounds like access rights is just the most probable solution, not the one that was checked. – Jakob Lenfers Aug 28 '15 at 7:48
  • @JakobLenfers thanks. I did that and could access + write in the directory. Do you have any pointers about where else I could look for a solution? – Michael Aug 28 '15 at 7:53
0

I managed to stop the error messages and generate the sitemaps automatically.

When the server was created the cloud computing service provider had created a user. When I took control of the server I created my own user. The problem was fixed by setting the sitemap folders to be owned by the former user.

I still don't know why setting the folder to www-data:www-data wouldn't have worked and where to find the setting about this former user owning the sitemap generation process (apache or cron-related?)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.