Top Drupal Gotchas: "Access Denied" and Permissions Problems

By Spencer Critchley
October 31, 2009 | Comments: 12

The Drupal Content Management System keeps getting better and better. But the learning curve is still steep and the interface is still tricky - even after working with it for several years, some gotchas keep tripping me up. That tells me it's worth jotting them down, hopefully to spare a few other Drupallers falling into the traps I've fallen into enough times for all of us.

This time: Mysterious problems logging in or accessing content.

These are fairly common and can have a variety of causes. The ones I've found most often:

1. You just need to clear your browser's cache (I believe Drupal's cache management has improved, so that this is less common in recent versions).

2. You haven't given a particular user role permission to access a particular content type. Go to [yoursiteurl]/admin/user/permissions and make sure the appropriate boxes are checked (replace [yoursiteurl] with your actual site url, of course). Note that you need to do this every time you create a new content type (as when using CCK, the Content Construction Kit), or even when you are only adding a new field to a content type. Also note that giving a permission to Anonymous users does not mean that Authorized users inherit that permission. You have to check the box for each.

3. The SQL database has a problem. This can cause access or login problems even for the super admin user (user 1). Bearing in mind that you should back up your database before doing anything to it, you can try these fixes:

  • Rebuild permissions: Go to /admin/content/node-settings/rebuild.
  • Repair the Sessions table: You can use the appropriate SQL query for your DB, or an easy way is to use PHPMyAdmin. In PHPMyAdmin, choose your Drupal database, check the box next to the Sessions table, and find the "With selected" drop-down near the bottom of the page. Choose "Repair table".

The Sessions table seems to be prone to problems. I recently came across this idea at Stanford Tech Commons for keeping it healthier. It sounds useful, but I don't know enough about database innards to judge its reliability. Comments?


You might also be interested in:

12 Comments

I love you. This post just solved a permissions problem I'd been banging my head against for the last two hours. Thank you

Thank you so much. My site went down last night after installing a module. Admin access was denied - repairing the sessions table as you suggested has fixed the problem - thanks a bunch!

I had a permissions problem for a user assigned to a redactor role,

I tried everything here and my problem wasn't solved, I tried to affect same rights to authenticated user role (which is the default role for every user account) and it works well now :)

It didn't work for me, but I am sure it cleaned up some unnecessary junk in my database. I found the solution to my particular case of "Access Denied"-tis at the following link, which will likely complete the circle of possible solutions. Have a look at:

thedrupalblog.com/access-denied-you-are-not-authorized-access-page

Hi Denis, this is also covered by tip #2 in the post - overlooking content type permissions, separate from the user permissions list, is a persistent gotcha, even for experienced admins.

Hi Denis, this is also covered by tip #2 in the post - overlooking content type permissions, separate from the user permissions list, is a persistent gotcha, even for experienced admins.

OH MY GOD! You saved my sanity.

Once I repaired the session table, everything fixed itself. The site had been slow and laggy, I was having persistant issues with Access Denied issues.

Thankyou!

Glad to hear it! And thanks to all for the other comments here.

Number 3 saved my bacon! Never knew about rebuiliding permissions. Thanks for posting.

I had this problem and none of the solutions about or on Google fixed it. In my case, I was using CKEditor and there were three domains which could point to the site. In the Drupal settings.php file, there's a line which starts

$cookie_domain

some features of CKEditor require this, but it meant that when I accessed the site on a domain different to the one set here, I got 'access denied' even when logging in as admin.

To fix this, I set some redirects in the .htaccess file so that all access to the website would come through the one, authorised domain. Job done.

Computer software can easily get corrupted. It is possible that many times it can deny access to the user. London computer repair assist to solve the problems related to software.

Thanks for this! The Sessions table is what was preventing me from accessing admin pages. Fixed my problem!

News Topics

Recommended for You

Got a Question?