Drupal 'Access Denied' on all pages

Ran into an interesting little snag this morning - a client's Drupal site was spitting out "Access Denied" errors for all page loads by anonymous users. It didn't appear to be a permissions problem - the nodes just wouldn't let anyone look at them.

A bit of Googling found a bunch of posts like this that say that, for some mysterious reason, Drupal can lose the contents of the node_access table and you need to repopulate them.

INSERT  INTO  node_access
  (nid ,gid ,realm ,grant_view, grant_update , grant_delete)
  VALUES ( '0',  '0',  'all',  '1',  '0',  '0')

Unfortunately, I didn't exactly have access to the client's database. A bit of poking around in the source showed me that visiting /admin/content/node-settings/rebuild would fire off an internal process to do the same thing.

Crisis averted, fix discovered. I just hope I don't need to use it again in the future.

Filed under 

Awesome! Thank you. Yet another entry into my massive little Drupal quirks file. I really start to wonder at times how much time I'm saving with Drupal when you take into account the hours scouring the interweb to try and find solutions to its... features. Yawn.

Thanks. We've been wrestling with intermittent permissions issues for a few weeks now (and rebuilding permissions would lead to all anonymous users being denied access to all pages). This fixed it. I hope it sticks. :)

I implemented your solution by visiting /admin/content/node-settings/rebuild as you suggested. The result, which took about five seconds, repopulated the contents of the node_access table.

Was searching for a day... I lost my contents after using cache....
Didn't see thois ioption in the back office.
your tips solved everything.
just a word, thanks a lot.

Like all before me, a GIANT THANK YOU, You saved my day from becoming shitty with this strange darn issue. I already saw the hours that I'm going to spend on this, but now I'm not, thanks to you! :)

Elegant and quick solution!

Add new comment

Restricted HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <h4> <h5> <h6>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>&lt;code&gt;</code>, <code>&lt;blockcode&gt;</code>, <code>&lt;apache&gt;</code>, <code>&lt;bash&gt;</code>, <code>&lt;c&gt;</code>, <code>&lt;cpp&gt;</code>, <code>&lt;css&gt;</code>, <code>&lt;drupal5&gt;</code>, <code>&lt;drupal6&gt;</code>, <code>&lt;html&gt;</code>, <code>&lt;java&gt;</code>, <code>&lt;javascript&gt;</code>, <code>&lt;mysql&gt;</code>, <code>&lt;objc&gt;</code>, <code>&lt;php&gt;</code>, <code>&lt;python&gt;</code>, <code>&lt;ruby&gt;</code>, <code>&lt;sql&gt;</code>, <code>&lt;xml&gt;</code>. The supported tag styles are: <code>&lt;foo&gt;</code>, <code>[foo]</code>.

About the Author