My host recently had some problems and reset many or all of my folder permissions.

Now, on admin/reports/status it says:

"Boost Can not write to file-system
Directory .../cache/perm/www.....com credentials - Permissions: 0777. Owner 2525. Group 2526.
Your credentials - Group ID: 2526. User ID: 2525. Current script owner:..."

I have already reset permissions to 777. How come it can't write if the permissions are set to 777?

Comments

mikeytown2’s picture

You do it recursively from the cache folder? Do you have php is a super paranoid mode where it won't write to the file system?

david@teachermadevideos.com’s picture

Thank you for the reply to his problem above. I have the same problem. And I have two questions.

It seems an unacceptable security risk, IMHO, to chmod 777 any directory except as a diagnostic test for a few minutes. That's the only way I used it. Even so, it did not allow boost to write.

1) What would be the php settings to look for in the output of info.php, to determine if php was in a mode which did not allow it to write to the cache file?

2) It seems that his problem above (possibly mine too) is a chown issue. Which of the three-- "apache", "admin" or "root" -- shoiuld be designated as the owner of the folders and files in the cache file path?

Thanks a million for offering help in here.

A CLUE?
fwiw, I also get a series of five error msgs similar to this:

warning: file_put_contents(cache/perm/www.mysite.net/.boost) [function.file-put-contents]: failed to open stream: Permission denied in /home/admin/mysite/sites/all/modules/boost/boost.install on line 80.

david@teachermadevideos.com’s picture

Also, I wanted to get your opinion on 775 permissions, rather than 777.

775 should give the same broad permissions as 777 except to random users, right? I understand this in a general sense. But I am not sure about it as it may apply to boost.

mikeytown2’s picture

You have safe mode enabled on your server. To fix this issue, you can CHOWN the directory to be the same as PHP/Apache or try deleting the cache directory and let PHP create it.

In terms of 777 vs 775 it depends on your servers setup. If its properly configured then 775 should be all you need. Sometimes 775 doesn't work though so you have to use 777. If you have random users logged in your your server (via SSH) then you have some major issues.

OneTwoTait’s picture

Started by deleting the cache folder via FTP, but quit after about 3 hours. Seems there is a limitless number of sub-folders within it.

I can't find any evidence that Boost isn't actually working. Could the status report be wrong?

If not, I'll see if I can find somebody to clown the directory...errr CHOWN it.

mikeytown2’s picture

strange... it can create directories but it can't create a file. Is your sites/all/files directory writable; does it work correctly?

OneTwoTait’s picture

I had some issues with images in sites/default/files earlier too but I changed the permissions to 777 and then it worked.

Boost worked correctly before. I'm not sure it isn't working correctly now, except for the error notice on admin/reports/status. I just figure that error notice means it is having errors somewhere.

mikeytown2’s picture

Your server might prevent boost from creating files that start with a period. Other then that I can't think of anything else...

OneTwoTait’s picture

I asked the host and they CHOWNed the folder. The error is now gone. Will test.

FYI, The site is higher traffic than it was before and when Boost is restarted I think it is trying to cache many pages per minute. That may have been what made the site super slow for a bit. Or perhaps Boost was just hitting a brick wall with those folders that it couldn't use...

Before the CHOWN and before I put it in maintenance mode, the "CPU Usage" was at 5000% percent. Now after the CHOWN and after putting it back out of maintenance mode the CPU usage is low again.

mikeytown2’s picture

Status: Active » Fixed

marking as fixed. reopen if issue is still affecting you.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jeffbellamy’s picture

Let me sound REALLY stupid, but how do I set up the file cache/perm/zerodouble.com. Do I have to go to my server root and set up a directory called Cache, then put a directory called Perm in it and then put that website in it?

mikeytown2’s picture

create a directory called cache that is writable by apache/php and boost will do the rest

Marko B’s picture

I switched to VPS recently and started getting same errors, hope i will resolve this soon and post what to do step by step...

p.s.
safe mode isn't on my php, but message i get is

Boost Can not write to file-system
Directory /srv/www/mysite.me/public_html/cache credentials - Permissions: 0755. Owner 1000. Group 1000.
Your credentials - Group ID: 1000. User ID: 1000. Current script owner: setup.

Marko B’s picture

Works when 777 is on, when 755 i get above problem. I dont know how to set apache/php to be able to use cache dir as i am new to linux, if someone knows please write an example.

johnshih’s picture

I had the same errors.

I've changed my permission setting and fixed this problem.

cache (folder) to 777
.boost (file) to 766

Aurochs’s picture

running drupal 7.9
i was about to go mad with this problem. i dont know where to check the php paranoid mode, was looking throu my php and did not find it there. i was chown chgrp etc etc with root and username and was changing ny user homedir and chmod 777 many times but got 644 created for new files.
tried latest dev release from october 2011
i changed _ in the prefix to empty space - same thing with front page
finally i changed the _ in the prefix to 1 and its working now

but still i wonder where do i have the protection for files starting with bottom slash or maybe _.
i have nginx+apache2 as backend and redirect from nginx to apache2 also when nginx thrown to errors 4xx 5xx etc

newone.org’s picture

[root@newone.org]cd /path_to_drupal_installation
[root@newone.org]find . -type d -name cache -exec chmod ug=rwx,o= '{}' \;
[root@newone.org]find . -name cache -type d -exec find '{}' -type f \; | while read FILE; do chmod ug=rw,o= "$FILE"; done
[root@newone.org]find . -name cache -type d -exec find '{}' -type d \; | while read DIR; do chmod ug=rwx,o= "$DIR"; done

duckzland’s picture

In my case I need to change the owner and group of the cache directory to apache.apache (the user that apache run under)

kalanh’s picture

I was getting this issue with all directory permissions set to 775 and cache/.boost set to 644 during a server migration from RHEL to CentOS. The Plesk panel owned the cache directory (psacln) so all that was needed was a recursive chown call from the Drupal root directory to assign the owner as apache apache:

[root@domain ~]# ll cache
drwxrwxr-x 453 domain psacln 20480 Jun  1 17:58 normal
drwxrwxr-x 446 domain psacln 20480 Jun  1 17:51 perm
[root@domain ~]# chown -R apache:apache cache
[root@domain ~]# ll cache
drwxrwxr-x 453 apache apache 20480 Jun  1 17:58 normal
drwxrwxr-x 447 apache apache 20480 Jun  4 12:15 perm
sam moore’s picture

I just had this same issue - though /cache was set to 777, Boost still couldn't write to it (at least according to status report).
I changed ownership to www-data (I'm on Ubuntu, and that's what the server runs as) and that cleared everything up.

chown -R www-data:www-data cache
chmod -R 766 cache

And all is well.

Is suhosin somehow involved here?

Anonymous’s picture

And all is well.
Is suhosin somehow involved here?

No. On multiple rented web space a module or program called suExec or suPHP is used where the webserver becomes you the user and writes out a file. This makes it easier for newbies as the user for uploading the files to the website is the same as the apparent webserver user. In more powerful set ups, then apache is running as it's own user called either nobody, apache, wwwrun, or www-data This user can only write to certain folders, has no home directory, cannot log on, has no password, so is very low privileged, whereas in the shared hosting environment, the webserver user can also control the ftp log on and probably some cron jobs too. If you had used the php mkdir() function for your cache folder then you would have experienced no issues at all, except that you may not be able to delete of move files inside the cache as your ftp user as they are not owned by you.

Suhosin is an apache module to harden apache sessions. It bolts on and encrypts session data and locks it to a browser, ip address, and time and then decrypts the session on the fly. This is to stop someone between a browser and a server from hijacking a session or from someone who has hacked the server, from reading session details that could be stored in plain text. Custom functions in shopping carts sometimes store session information like delivery address in plain text so a clever hacker could intercept the "mark as paid" command to the shop, and alter the session and change the address details so your goods would end up in Leeds as opposed to London. But it would probably be easier to hack the PHP pages on the server and just change the delivery address in the database. Suhosin is an extra level of defence to stop man in the middle attacks, or session hijacking, where you've entered your credit card details into one page and another page/ image/ tab uses javascript to intercept the information and send it to a third party to try and buy goods.

It's rather dangerous this surfing business all that is between you and the fraud is a tiny cookie being sent in the header to a website.

sam moore’s picture

@Philip_Clarke - thanks for that - very helpful.
I'm on a VPS, and in the process of debugging (and I use the term loosely - in my case it in fact means "staring at the screen for a very long time") I added www-data to the users group, but that didn't help. Perhaps I should go undo that...
Anyway many thanks for your insight.

Anonymous’s picture

Having a VPS needs a bit more skill than basic web space, for one thing you are normally the superuser and responsible for updates (and anything that goes wrong), either get a basic linux sys admin book or if it's taking up more time than content creation, hire someone to maintain it, they'll be able to set up automated updates and then tune as required so it's only a few hours per month.

duckzland’s picture

You need to check what user is apache run under from apache config file and since you are on a vps its better to install suPHP or rusuid module for apache, its not that hard to install those, depending on what flavour is your linux (ubuntu, centos etc etc).

If you can afford a bit more expensive server, get a managed vps like getcadre.com, they'll set the varnish, apache, php, mysql etc etc for you.

Anonymous’s picture

I strongly disagree with that, better that apache is running as an unprivileged user and that it just requires the odd chown or chmod, then have apache running as the same user as ftp, postfix, dovecot etc... all to avoid learning a few lines of code. I declare an interest in that I do manage servers for small businesses but also I have to rescue many a small business on shared hosting with badly set up permissions when there's been an exploit and that costs a tremendous amount of time and money to fix, plus there are legal implications e.g. bob gets hacked, the hacker plants a file on joe's server, you can't alter bob's server to close the exploit and legally that's not joe's property to remove. Then two businesses ending up paying ISP rates for removing files or get suspended/ blacklisted and in a few cases have been subject to chargebacks and withdrawal of merchant services.

blogers’s picture

same problem on vps drupal 6 fix for this please

Anonymous’s picture

This is unlikely to be a boost issue, in all likelihood you have a server set up like suPHP or suExec that will not allow PHP to write files if the folder is not owned by the php user, or if the permissions of the folder are not 0755 or less. A basic linux sysadmin book and you could probably sort this out in under 30 minutes.