Access denied on all pages

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
newz2000's picture

I just upgraded two sites to Drupal 6. They're on a testing server, not publicly visible. One went fine, the other one appears fine unless you try to browse it anonymously. Every page gives you an access denied error saying "You are not authorized to access this page. "

I checked the roles and tried checking "access content" for all roles, also unchecking it for all roles (including anonymous in both cases) but no improvement.

Any idea what would cause this?

Comments

rebuild permissions fixed it

newz2000's picture

There is a button to rebuild permissions. It fixed it.

--
Matthew Nuzum
newz2000 on freenode

--
Matthew Nuzum
newz2000 on freenode

hi there all pages shows access denide

shabanbi's picture

how can i rebuild permissions ,my site all pages admin login,users login shows access denide how to solve this problem ,my site almost final stage ,i can change user permissions after that this errors came ,

plz give me solution

Regards,
shabanbi

A note on rebuild permissions

Michael Hofmockel's picture

The rebuild permissions can be found at - /admin/content/node-settings/rebuild

It may not be their if you have not yet added an ACL modules (ie. node_access table has only one row) but you can still access it by going directly to the page.
http://drupal.org/node/147961

Regards,
Michael Hofmockel
iMed Studios

Open Source || Open Access || Open Mind

Regards,
Michael Hofmockel

Open Source || Open Access || Open Mind

Thanks!

Mi-Young's picture

This was helpful.

Rebuild Permissions in Drupal 7

aquaseal's picture

Drupal 7 has moved the Rebuild Permissions link, it can be found at - /admin/reports/status/rebuild

You can also navigate to Reports -> Status report and the link is under the Node Access Permissions row.

mahtoranjeet's picture

When I am trying to login by admin or any other user it sent me a page where "access denied : You are not authorized to access this page. " message is showing. I empty all cache tables and rebuilt the permissions by going directly on this page "admin/content/node-settings/rebuild". BUT I am still getting same message. Please give me solution.

Thanks in advance.

I am also having the problem

veleiro's picture

I am also having the problem after switching to private download method. I don't want to have to remake my site as there are hundreds of nodes of content. Please asist

I am also experiencing this

dpalmer's picture

I am also experiencing this issue.

I have just ran into this

bejii's picture

I have just ran into this problem now: admin/content/node-settings/rebuild didn't seem to help...help please!

Did you clear caches after?

scottatdrake's picture

Did you clear caches after?

I think it has somethign to

bejii's picture

I think it has somethign to do with the adserver.inc

Ad module failed to access cache sites/default/files/.1.ad.cache. Verify file permissions.
Ad module failed to access cache sites/default/files/.2.ad.cache. Verify file permissions.
Ad module failed to access cache sites/default/files/.3.ad.cache. Verify file permissions.
Ad module failed to access cache sites/default/files/.1.ad.cache. Verify file permissions.
Ad module failed to access cache sites/default/files/.2.ad.cache. Verify file permissions.
Ad module failed to access cache sites/default/files/.3.ad.cache. Verify file permissions.
Ad module failed to access cache sites/default/files/.1.ad.cache. Verify file permissions.
Ad module failed to access cache sites/default/files/.2.ad.cache. Verify file permissions.
Ad module failed to access cache sites/default/files/.3.ad.cache. Verify file permissions.
Ad module failed to access cache sites/default/files/.1.ad.cache. Verify file permissions.
Ad module failed to access cache sites/default/files/.2.ad.cache. Verify file permissions.
Ad module failed to access cache sites/default/files/.3.ad.cache. Verify file permissions.
Ad module failed to access cache sites/default/files/.1.ad.cache. Verify file permissions.
Ad module failed to access cache sites/default/files/.2.ad.cache. Verify file permissions.
Ad module failed to access cache sites/default/files/.3.ad.cache. Verify file permissions.
Ad module failed to access cache sites/default/files/.1.ad.cache. Verify file permissions.
Ad module failed to access cache sites/default/files/.2.ad.cache. Verify file permissions.
Ad module failed to access cache sites/default/files/.3.ad.cache. Verify file permissions.

Ad module file-cached data has been flushed to the database.
Ad module file-cached data has been flushed to the database.
Ad module file-cached data has been flushed to the database.

http://drupal.org/node/877482

Can you log in? Try disabling

scottatdrake's picture

Can you log in? Try disabling that module.

I deleted the module, I

bejii's picture

I deleted the module, I cleared the cache, rebuilt permissions (admin/content/node-settings/rebuild ) and ran cron.php...nothing. each page is still: Access denied You are not authorized to access this page.

This is unbelievable...

To all of those having the

veleiro's picture

To all of those having the problems above. Check your modules. Are you using CKEditor? There was a known issue that I ran into http://drupal.org/node/1324990

It is most likely not a problem with core. Go back and check your modules: turn them all off, then enable only a few at a time and check the results.

I do not have CKEditor i have

bejii's picture

I do not have CKEditor i have FCKeditor

Are you sure rebuilding

scottatdrake's picture

Are you sure rebuilding permissions actually completed? That worked for me when I had this issue. Using drush? Try running it from the command line with 'drush php-eval 'node_access_rebuild();'

Are you using the Content Access module? It seems to be prone to these kinds of issues.

No I do not have the Content

bejii's picture

No I do not have the Content Access module installed. my content access had grand_view set to '0' in phpMyAdmin. I changed it to 1, as stated here: http://www.metaltoad.com/blog/drupal-access-denied-all-pages

and still nothing...

I've seen this same solution

scottatdrake's picture

I've seen this same solution mentioned in a few places. Can't say I know what it does but might be worth a shot.

http://praveenksubedar.blogspot.com/2010/09/drupal-access-denied-on-all-...

I have tried this, keep in

bejii's picture

I have tried this, keep in mind...I AM A ROOKIE when it comes to php.

This is exactly what I have done:

logged into phpMyAdmin
clicked on node_access from the left menu
hit SQL tab on the top (in the right window)

entered this exact code:

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

i was given an error that read:

"Error
SQL query:

INSERT INTO node_access(

nid,
gid,
realm,
grant_view,
grant_update,
grant_delete
)
VALUES (
'0', '0', 'all', '1', '0', '0'
);

MySQL said:

1062 - Duplicate entry '0-0-all' for key 'PRIMARY' "

Do you know what that means?

SOLUTION!!!!

bejii's picture

WHOOOP!!!

After 6 + hours of messing around with this I have found it:

node_revisions had crashed...the code

REPAIR TABLE node_revisions

fixed it. If you guys are still having trouble, try it out...and you hopefully wont have to waste 6 hours like I did

This solved it for me

dwalker51's picture

I couldn't login to my backup site on www2 after copying my site from www and restoring the database.. no user could log in (including admin)...

it was due to not setting cookie domain from www to www2

/**
* Drupal automatically generates a unique session cookie name for each site
* based on its full domain name. If you have multiple domains pointing at the
* same Drupal site, you can either redirect them all to a single domain (see
* comment in .htaccess), or uncomment the line below and specify their shared
* base domain. Doing so assures that users remain logged in as they cross
* between your various domains. Make sure to always start the $cookie_domain
* with a leading dot, as per RFC 2109.
*/
$cookie_domain = 'www2.ctio.noao.edu';

This solved it for me

dwalker51's picture

I couldn't login to my backup site on www2 after copying my site from www and restoring the database.. no user could log in (including admin)...

it was due to not setting cookie domain from www to www2

/**
* Drupal automatically generates a unique session cookie name for each site
* based on its full domain name. If you have multiple domains pointing at the
* same Drupal site, you can either redirect them all to a single domain (see
* comment in .htaccess), or uncomment the line below and specify their shared
* base domain. Doing so assures that users remain logged in as they cross
* between your various domains. Make sure to always start the $cookie_domain
* with a leading dot, as per RFC 2109.
*/
$cookie_domain = 'www2.ctio.noao.edu';

This was my solution

nitrox007's picture

Luckily for me, I had just downloaded the Backup and Migrage module and had downloaded a full database backup. If you had a cron job scheduled to back up your site, then this will work for you.

Basically, I went to phpmyadmin, cloned the "node_access" table (click on node_access on the left -> click the operations tab -> copy table to) into a new table "node_access2". Then I opened the .sql file from the backup, looked for the part to insert into node_access table, and pasted it into SQL tab of the new table I just created.

You have to change the table name to reflect the new table name. In my case from "node_access" to "node_access2". Then you run the command and all the data is inserted to new table.

Then I renamed the old table from "node_access" to "node_access3", and renamed the new table from "node_access2" to "node_access".

Everything came back after this. I know this will not work if you don't have a back up of your site, but if you happen to have one, this should do the trick.

Hopefully this can help someone. I was about to have a panic attack when I lost these permissions (which btw were lost when I clicked on "Rebuild Permissions", so if you see this show up in your drupal admin site, be very careful and make sure you back up your site before you do that)

P.S. This was Drupal 7