Home

Primary links

  • top o the deck
  • Drupal for Beginners
  • about
  • links
  • give me some sugar

Drupal stuff

  • EDAM
  • STARDOM
  • Question Bank
  • Drupal musings
  • Drupal tips
Home

Key stuff on this site

Easy Drupal Admin Manual (EDAM)

SEO, Traffic and Revenue: Drupalace's Online Manual (STARDOM)

Drupal for Beginners

Subscribe to posts by RSS or email

Subscribe to Drupal Ace by RSS feed RSS feed 

Subscribe to Drupal Ace by Email

Donate towards my web hosting bill! Get a great host!

Share and save

Share/Save

Random piece of content

Test post using MarsEdit 2.4

Manuals on this site

  • Easy Drupal Admin Manual (EDAM)
    • Welcome to Your Site
    • First Steps: Please Read!
      • Understanding These Instructions
      • Important Terminology!
      • Best Practices for Site Admins
    • Super Quick Guide (for the experienced and the brave)
    • Logging In
    • Your Administrator Tools
    • Setting Site Basics
      • Setting Site Information
      • Configuring Your Theme
    • Creating Content
      • Node Types
      • Create a Page Node
      • Create a Story Node
      • Create a Blog Entry Node
      • Making Images and Other Files Available
      • Using Text and Image Editors
    • Organizing Your Content
      • Terms, Vocabularies, and Taxonomy: "Tagging" Your Content
        • Taxonomy Suggestions
      • Menus, Links, and Paths: Navigating the Site
        • Content Paths and URLs
        • Creating Links
        • Working with Menus: Administration Form (Drupal 6)
        • Working with Menus: Administration Form (Drupal 5)
        • Creating Menu Items on the Fly
        • Placing Menus on Your Pages
      • Placing Content on pages
        • Creating a page from a Single Node
        • Creating a page from a List of Nodes
        • Setting the Front Page
      • Working with Blocks
    • Maintenance Stuff
      • Maintenance and Construction Notices
    • Other Fun Things
      • Changing Color of Garland Theme
      • Free Aliases!
  • SEO, Traffic and Revenue: Drupalace's Online Manual (STARDOM)
    • Set a Clear Goal
    • Make a Good Site
      • Put out the Welcome Mat
      • Make Great Content
      • Build a Great Brand
      • Make Navigation Easy
      • Tune Site Performance
    • Drive Traffic
      • Promote your Site
      • Get Found with SEO
    • Build a Community
      • Build an Offsite Community
    • Monitor and Improve
    • One-Page Checklist
    • Drupal and the Blogging Starter Checklist
      • Drupal and the Blogging Starter Checklist, Part 1
      • Drupal and the Blogging Starter Checklist, Part 2
      • Drupal and the Blogging Starter Checklist, Part 3
      • Drupal and the Blogging Starter Checklist, Part 4
      • Drupal and the Blogging Starter Checklist, Part 5
      • Drupal and the Blogging Starter Checklist, Part 6
      • Drupal and the Blogging Starter Checklist, Part 7

You said it!

  • Tough one to Inves...

    I have heard and read stories such as this one before, and their common denominator is Drupal...

  • exclude

    excellent tip - can highly recommend the module - installed and working perfectly in drupal 7

  • Great CMS

    This book seems very interesting as I am currently starting a project to build a community site...

  • Thanks!

    Thank you very much !

  • Thank you very muc...

    Thank you very much !

more

How to fix "Access Denied" for admins?

Submitted by Drupalace on Sat, 2007-09-29 00:41
  • Drupal
  • login
  • answered question

Yikes! A client's site suddenly turned up "Access Denied" for admins – up, down, and all around. Attempts to log in as almighty User ID 1 would simply spit the login screen right back again, or appear to "take" momentarily, yet return "Access Denied" for any following admin action.

Some horrible flub-up with user permissions? Can't even check and troubleshoot when the site won't let the admin in! And playing with cache, cookies, and other browser fiddly bits wasn't doing the job.

Question answer: 

I expected major pain to result. But a search of the Drupal site quickly turned up this gem:

http://drupal.org/node/6696#comment-198054

Just a little addition to my INDEX.PHP file. I tried it, and Huzzah! Back in logged-in action.

The cause of the problem? Perhaps this:

http://drupal.org/node/6696#comment-204960

Hmm, could it be that the ISP had updated PHP from 4 to 5? Yes, it seemed so! (Maybe now I'll start to pay attention to their newsletters.)

So the thread addressed my woe, and I'm a happy Drupaller all over again. Now, this particular case had a Drupal 4.x site knocked out of action by a PHP upgrade, so it may not apply directly to many users' situations. But if you're getting "Access Denied" hate (on 4.x or 5.x), give the linked thread a peek.

My thanks to everyone offering help on the topic, especially Drupal Gods kweisblatt and johnchalekson!

Share/Save
  • Printer-friendly version
drupalBidule's picture

do not not forget to check the sessions table

Submitted by drupalBidule (not verified) on Wed, 2011-12-07 20:29.

same problem, different issue ! my sessions table was the problem. Check if you have no error message there and if so delete it and replace with a new one.I came accros this issue some weeks after moving to a new server. Drupal 5.

  • reply
Unknown Drupaloid's picture

FIXED THIS FOR ME!

Submitted by Unknown Drupaloid (not verified) on Sun, 2011-09-25 08:56.

This one was my fault - I'd changed the domain for a site that I'd built and didn't change the $cookie_domain line of settings.php to reflect this.

After changing this line to the correct domain it now logs me in fine!

  • reply
Drupalace's picture

Don't forget settings.php

Submitted by Drupalace on Sun, 2011-09-25 11:26.

Heh. I think I've finally gotten good at checking and editing settings.php as needed, but in the past, I couldn't count how many times I've made the same kind of oversight you describe.

Semi-tangential comment: For typical computer users like me, coming from a GUI world, Drupal's been quite the introduction to configuration files and (occasional) command lines. Those methods can seem awfully futzy to those of us raised on neat GUI tools, but more and more Drupal is teaching me the power of The Old Ways. : )

  • reply
seo techniques's picture

this is very valuable

Submitted by seo techniques (not verified) on Fri, 2011-06-03 00:16.

this is very valuable information i didn'y how to fix it thanks for sharing this :)

  • reply
Jaymie's picture

Using CKEditor? Your problem could be $cookie_domain

Submitted by Jaymie (not verified) on Mon, 2011-04-18 05:24.

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.

  • reply
hardware keylogger's picture

I had commented out this code

Submitted by hardware keylogger (not verified) on Thu, 2011-09-01 10:08.

I had commented out this code but still it give errors.What i do?

  • reply
Unknown Drupaloid's picture

Thanks! This solved the

Submitted by Unknown Drupaloid (not verified) on Thu, 2011-05-05 07:02.

Thanks! This solved the problem for me.  I commented out the $cookie_domain URL and I was able to log in again.

  • reply
arizona seo companies's picture

Thanks a lot for sharing. You

Submitted by arizona seo companies (not verified) on Sat, 2011-02-12 00:34.

Thanks a lot for sharing. You have done a brilliant job. Your article is truly relevant to my study at this moment, and I am really happy I discovered your website. However, I would like to see more details about this topic.

  • reply
Gerraro's picture

great job on the blog man.

Submitted by Gerraro (not verified) on Wed, 2011-02-09 01:54.

great job on the blog man.

  • reply
Azlura's picture

Had the same issue and not fixed it...help me please

Submitted by Azlura (not verified) on Mon, 2010-12-27 05:22.

My site has been running fine for a years, then all of a sudden I can't login under any username, even SuperAdmin. Entered username and password and it cycles back to the Homepage. Asked for a new password and followed the email link, again cycles back to the Homepage...

that's happen after i added a google ajax search module but i cancel for used it...and after disable that's module i want to create block but caould not....and then i log out....after that i want to LOGIN and add some posting but after i fiil in username and password...I can't login and it cycles back to the homepage...

I empthy cache on database and browser...but can't solve the problem.....i used opera, chrome and mozilla also can't solve the problem until now.

I have 2 website with the same problem and used Drupal v5.1.2 and v4.7
my website is : http://freewareshare.net and http://wirediagram.net Any suggestions ???

Thank you for your answer...
I really appreciated :)

Greetings

  • reply
Drupalace's picture

Can't log in to Drupal site

Submitted by Drupalace on Mon, 2011-02-07 00:25.

I missed your comment and this is probably much too late a reply to do you any good... But what I'm not sure of from your message is whether or not you're able to disable modules that may be causing the problem. If you are unable to disable modules because you can't log in, you could try to Disable a module from within database. 

  • reply
Anitra Dechaine's picture

reading blog posts is a lot

Submitted by Anitra Dechaine (not verified) on Thu, 2010-12-02 08:28.

reading blog posts is a lot like a life experience, it seems like the more I read the more I realize I don't know as many things as I thought. thanks for sharing ;-) and thanks to the impact of the internet!

  • reply
Steve's picture

If this didn't fix it.

Submitted by Steve (not verified) on Fri, 2010-11-12 04:18.

I had this problem and I tried the fix running 5.7. It wasn't throwing the correct error. I found that the sessions table was corrupt. If you look in the logs you will find

Error - Can't open file: 'sessions.MYI'

Check and see if you can select from the sessions table. If not, then run

sql>repair table session;

FIXED

  • reply
Pavel Khodorkovskiy's picture

Great tip, thank you. That

Submitted by Pavel Khodorkovskiy (not verified) on Tue, 2011-08-30 08:14.

Great tip, thank you. That solved it for me.

  • reply
Drupalace's picture

Fixing "access denied"

Submitted by Drupalace on Fri, 2010-11-12 15:14.

Thanks! I can't verify the method for myself – I don't have 5.x running anywhere now, and am not currently experiencing the issue either – but your comment may be a big help to others.

There are many possible causes for access errors of all types. Good to have a big toolbox of potential fixes to try,

  • reply
Neuron Genesis's picture

It worked

Submitted by Neuron Genesis (not verified) on Fri, 2010-09-03 01:23.

adding $GLOBALS['tempUser'] = $user; worked but I find it worth noting that I had to delete cookies first

  • reply
Drupalace's picture

Deleting cookies

Submitted by Drupalace on Wed, 2010-09-08 14:45.

Good point; thanks! Deleting cookies and/or caches, depending on the problem at hand, is a part of solutions that often gets overlooked. 

  • reply
Homa's picture

Same problem

Submitted by Homa (not verified) on Sat, 2009-09-19 06:26.

I have the same problem. Did you find any solution?

 

Thanks,

Homa

  • reply
Drupalace's picture

Yes, a fix

Submitted by Drupalace on Wed, 2009-09-23 16:38.

If I recall correctly: Per the link in the article, adding 

drupal_page_footer();
$GLOBALS['tempUser'] = $user;

to the end of the index.php file did the trick. That was Drupal 5.x for me, though, long ago, and concurrent with an upgrade from PHP 4 to 5 by my webhost. So it may be a useful fix for you, if you happen to be under those same conditions. 

 

  • reply
Geir's picture

Re: How to fix "Access Denied" for admins?

Submitted by Geir (not verified) on Thu, 2008-07-31 18:12.

Didn't do it for me.
I can log in as user 1, but gets access denied to all the admin-stuff..

  • reply
Zarathoustra's picture

Faced the "Access Denied" for admins twice!

Submitted by Zarathoustra (not verified) on Wed, 2011-11-02 19:53.

I don't know, for all of you, but for me even after adding "$GLOBALS['tempUser'] = $user;" at the end of index.php file, nothing changed. The first time the problem occured, I recreated quickly the platform, thinking that I had done surely a bad administrative operation on the plateform. Then, the problem reappeared again, on that new one! Now I'm stuck!

What's going on? I'm using Drupal commons, to build my platform! And even the cron task failed after enabling some modules related to the instant chat.... I'm going crazy!!! Help please...

  • reply
Drupalace's picture

Re: How to fix "Access Denied" for admins?

Submitted by Drupalace on Thu, 2008-07-31 22:26.

Ack, that kind of thing is frustrating as heck. I imagine there are many, many little ways that an installation can get screwed up and deny access.

The best immediate step you can take is to throughtly search the Drupal.org forums for more possibilities, and beg for help if nothing good turns up. All of which you've probably already done... : (

  • reply
Unknown Drupaloid's picture

Re: How to fix "Access Denied" for admins?

Submitted by Unknown Drupaloid (not verified) on Mon, 2008-01-07 02:59.

Thank you! My ISP just upgraded their default PHP installation to 5 on 1-1-08. Thank you for sharing this.

  • reply

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><br><p>
  • You may quote other posts using [quote] tags.
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options


Relevant Content

The Drupal Ace logo has dealt these content suggestions from the deck.

  • Working with Menus: Administration Form (Drupal 6)
  • Logging In
  • Newbie Emergency #1: "I'm locked out!"
  • Test post using MarsEdit 2.4
  • Drupal site recipes
  • Drupal and DreamHost: An Update
  • Forum Finds: Modify length of user login sessions

Learn Drupal, hands-on

Get the beginner-friendly ebook that teaches community site building via a live case study.

Drupal 6 Ultimate Community Site Guide

Read the review

It's a deal!

Dreamhost dealsDrupal Ace presides over his domain, proudly ensconced in his DreamHost eyrie. Won't you join me?

Promo code deal!

Just enter the code 49ER when you register for an account, and save $49 off the already-low price. No strings!

Read my hosting service review

Drupal mini tip

Need to disable a Drupal module but can't do so from within the site? (This could happen if the wayward module is preventing you from reaching the Modules form!) Look for the module's entry within the "system" table of the site's database, and set the module's status to "0". 

(From within phpMyAdmin: Select the "system" table from the column of tables at left. Click the "Browse" tab. Find the row for the module you wish to disable, and click the "pencil" icon in that row. In the resulting form, input "0" for the Value of "status", and click the "Go" button. Done!) 

Powered by Drupal, an open source content management system

Copyright 2007 and forever after. Made with Drupal, of course. On OS X, of course. Served up by DreamHost. DreamHost

RoopleTheme