Ok Everything on site has been working great for 2yrs and yesterday all of a sudden anonymous users can't see stories or any content until they login as a member. I was deleting a few unscrupulous users just prior to this going bananas. Help how do I fix??

Comments

briandelicata’s picture

You will need to reset the node access table (Dbl check that anonymous users have 'access content' permission in access control first)

In phpmyadmin:

TRUNCATE node_access;

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

Keith2005’s picture

Ok logged in as root in phpMyAdmin, when to my data base where I could see the access, access log, etc in the left menu. Ran your command above hit go and got this..
Your SQL-query has been executed successfully

SQL-query : [Edit] [Create PHP Code]
TRUNCATE node_access;# MySQL returned an empty result set (i.e. zero rows).
INSERT INTO node_access( nid, gid, realm, grant_view, grant_update, grant_delete )
VALUES ( 0, 0, 'all', 1, 0, 0 ) ;# Affected rows:1

But I'm still getting thing at the home page. or any link I try untill I log in as someone???

Access denied
You are not authorized to access this page.

vm’s picture

have you double checked the permissions in access control ?

version 4.5 is running short of users to support, have you considered upgrading to at least 4.7.6 ?

Keith2005’s picture

access control ? are you refering to admin to administor/users/permissions/node module/access content then putting a check in the box to allow anonymous user?

vm’s picture

My assumption is yes, that is what im talking about. however I don't use Drupal 4.5. In Drupal 4.7 and Drupal 5 (The two versions I've used) its called access control.

Keith2005’s picture

Is there anyway I could have broken anonymous user? The Site http://www.pioneer-net.com/newhome looks like it should except you can't see any of the stories until you login or create a new member. I'm just missing something. Help I'm thinkin Reward at this point..

vm’s picture

go into the usertable and see if the anon user is there ?

Keith2005’s picture

Do you mean located in drupal or mysql ?

vm’s picture

in your mysql database, inside the users table, you don't have to dump it you can view it using phpmyadmin if its on your server. Insure that you do indeed have an anon user.

Keith2005’s picture

when I sorted by uid 1 is the first which is me. Isn't anon supposed to be 0?

vm’s picture

yes the first uid should be 0 which would be for anon users.

have you been keeping up with security updates ?

Keith2005’s picture

Na..I was dropped out of a airplane into this linux,mysql,drupal seat without any prior and I'm trying to get a handle on it all in full tilt operation. I do all the tower antennas' & networking them to the customers also. Can I readd anon ?
Thanks

vm’s picture

yes you can re add an anon user in the database manually. I am not a MySQL expert so I don't know what query to tell you to run.

it may be quicker for you to install another copy of Drupal 4.5 and inspect the way that the anon user is in a fresh install and replicate it on the production install. Considering you don't know how the anon user was erased, I would seriously consider updating your installation so that you aren't being hacked. 4.5 is outdated by 3 major releases now, let alone any secuity updates you missed along the way.

Keith2005’s picture

I added user 0 to MySQL but i'm still getting the same errors.

vm’s picture

did you double check it against a fresh install of Drupal 4.5? to insure you added all the table information other then just 0 for user?

I'm out of ideas, you may want to start another thread with the title, how to insert anon user in Drupal 4.5 to try and entice those with more knowledge about it.

nadezhda’s picture

In another "access denied" thread, you can find the MySQL query to add the anon user if it's somehow been lost. It will return an error if the 0 user already exists. drupal.org/node/20397#comment-111175

davidburns’s picture

I was having a heart attack till I found this.
If anyone is experiencing this problem run this query, even in 5.x it works.

My problem originated when I removed Organic Groups from my module list.
All my views and nodes became access denied. This corrected that problem.

THANK YOU!

theTHISorTHAT - personal weblog

elemental@drupal.org’s picture

Thanks davexoxide and all others who posted here. I was also sweating a bit when I logged out of my admin user to check the site out as anon. CRAP!!! ALL PAGES ARE "ACCESS DENIED"!!!! That's a bit scary for sure! LOL. But like davexoxide said, by emptying or trunicating the node_access table and then inserting a row with the values ('0', '0', 'all', '1', '0', '0') it worked like a charm. The site that this happened and was fixed in was running Drupal 5 so this is definitely a fix that you can use with that release.

Like dave, I also recently removed Organic Groups from the site in dev. So I'm guessing this is the start of a trend. Thanks again dave for mentioning that bit of info. It's always nice to have a good idea of where the problem started.

Thanks again!

flavor’s picture

I disabled organic groups - and then when other people would edit the content it would become unreadable by anonymous visitors - I ran the suggested solution and it did not work.

So I just re-enabled organic groups - problem solved.

http://www.ridgeworksinc.com - helping you participate in the Internet!

jayboodhun’s picture

I was having problems accessing pages as anonymous user. I could only access pages when i had node administration turned on in my permissions.After inserting the row ('0', '0', 'all', '1', '0', '0') in the node_access table, it certainly fixed the problem.

Thanks again.
Jay

sraisz’s picture

Inserting the row ('0', '0', 'all', '1', '0', '0') in the node_access table fixed my problem. too.

But I can't figure out how it happened.

miktham’s picture

I couldn't sort out what went wrong with my test site ? now I just sort it out with your all wonderful help. I am really pleased with drupal buddies.

T.M.Miktham

brianestadt’s picture

thanks, everyone.

dellis’s picture

THANK YOU SO MUCH!!!

I was guessing that the problem was the node_access table, this issue appeared seemingly randomly for me--but I'm pretty sure it had to do with the Workflow and or Modr8 module being disabled and uninstalled. Anyway, after looking (for this page!) all day I am relieved to find that this solution works. Thanks so very much.

bcobin’s picture

Brian,

I am sometimes almost moved to tears by how helpful you people are. I had a nasty, nasty problem (I'm sure this has to do with Image and getting Gallery2 integrated) where newly-created pages were suddenly "access denied" to anonymous users. I NEVER would have figured this out and I would have been totally hosed.

Your solution cleared it right up - THANK YOU!

Drupalace-1’s picture

This solution saved my bacon on a new site. I don't know why that particular brand-new site was having the trouble, but you fixed it right up. (Further details at http://www.drupalace.com/questions/how_fix_access_denied_visitors )

Thanks again!

--------
A site by, of, and for the Drupal newbie: http://www.drupalace.com

masterytv’s picture

Brian, et all...

You guys are unbelievable. I've been frustrated for hours with this as I'm a newbie with Drupal and a designer not a programmer or databaser (?).

All I can say is that if Karma is real and you reap what you sow, then you should be getting a visit from Publishers Clearing House soon.

It took me a while to find this post so I'm going to put in some keywords to help others find this.

Keywords:
Anonymous user, not logged in, before logging in, can't see, view, appear, some posts, story, stories, page, pages, polls, content. Access content box is checked, but I get access denied, not for admin but for other users.

phxl’s picture

amazing... thank you very much for this!

hobbes_VT’s picture

I had the same issue after implementing the workflow-nt module - all newly generated nodes were not visible to users other than admins although they were published. Adding the (0, 0, 'all', 1, 0, 0) into my node_access table resolved the issue.

A big "THANK YOU" to the great community of drupal users/developers !!!
I could resolve the issue within minutes (after finally looking for answer instead of finding the problem on my own for a couple of hours ... I should have come here right from the beginning)

lungtung’s picture

HI,

I use Drupal 6.2, and i got "Access Denied" on some page,
i've check node_access and i see ('0', '0', 'all', '1', '0', '0') in the database,

in my case i dont think the problem is node_access

module i've install:
+ fckeditor
+ nodewords
+ pathauto
+ token
+ xmlsitemap

Do you have any idea ?

eyecon-1’s picture

I have been pulling my freakin hair out. Anonymous users could access some content but but not all! I suspect that the nodeapproval module corrupted the db.

khan2ims’s picture

Hi,

This one worked for me. Thanks!! I was so worried about it.

Imran Khan
Project Manager
New Earth Marketing

KelleyBevans’s picture

I'm running a drupal 5.1 site www.obama08-wa.com and running the query worked like a charm - thanks guys!

Street-1’s picture

Let me join in the chorus of cheers.

I ran the queries and poof, my access denied issues for anonymous users in 5.3 where gone! Why I don't do a forum search sooner when I have problems, well... is probably related to my not asking for directions.

All good things must come to an end, enjoy them before they do!

drubage’s picture

This solution has helped me several times but I can never figure out what it happens. It never happens after I remove or ad any modules but it does seem to happen when I am messing around with role permissions (either in Access Control or in something like the forum access). Does anybody know WHY this happens so I can prevent it from happening in the future?

-Drew

trevorleenc’s picture

this is frightening, just had it happen on one my my dev installs...

subscribing. . . . .

p.s. the query did fix my problem.

coolmccool’s picture

When I installed and enabled Modr8 I disabled Workflow... and by chance a week later, I discovered that the articles I had written, approved, since were not showing up to Anonymous users...

This problem is especially bad, since neither the admin, or the author of the articles, will be aware that these articles are NOT showing up - they'll see the articles as they normally would.

My workaround was to simply [following the advice on this thread] enable Workflow again.

Drupal folks will need to ascertain which Modules this *bug* affects and why, and provide a patch. It IS a nasty one.

vm’s picture

if no one reports the issue in one of the modules issues querries providing a detailed summary in a way that allows the developers to recreate the problem. There is little chance of it getting fixed.

techguy10’s picture

Has anyone made any progress on this, I am now having the same problem, which was the correct solution its kind of confusing after reading through all the posts?

lungtung’s picture

hi,

im follow this post http://drupal.org/node/12757
INSERT INTO users_roles (uid, rid) VALUES (0, 1);

and finaly it work !

jamiegrove’s picture

I had the same problem. The SQL instructions included on this post work but you can also reset permissions on the anonymous user through the admin...

* Unchecked the box for "access content" under Admin:User Management:Access Control:Node
* Clicked "Save Permissions"
* Rechecked the box for "access content" under Admin:User Management:Access Control:Node
* Clicked "Save Permissions"

I just put up a blog post about this issue... :)

http://www.fieldguidetoprogrammers.com/blog/drupal/drupal-and-access-den...

alliax’s picture

I've been hit by this too for the first time ever in over 4 years of drupal use, on a relatively new site on a multi install based on drupal 6. WHY DOES IT HAPPEN ??? Who has a clue?

I don't use OG module and other mentionned in this thread, so it's not that. What can it be?
cafetieres expresso

fotios’s picture

After doing an upgrade from 4.7 to 6.10 anonymous access would get access denied errors while authenticated users had everything working fine.

I tried the solutions mentioned above but nothing worked. Then I thought it may have something to do with my browser cookie from the old site somehow messing up the new drupal. Deleted the cookies and (wow!) all was peachy.

Drupal people may want to add this as an instruction in the UPGRADE.txt file of upcoming versions.

Milkrow’s picture

I'm having the same issue before and after an upgrade to 6.14. I unchecked, saved, rechecked and saved the access content permission, deleted my cookies and tried adding the values to the node_access table in the DB (that wasn't clear to me how it should work) but nothing has worked. It could be I'm doing that last attempt wrong, but maybe its something else? Perhaps someone could provide screen shots or a more detailed explanation of how/where to insert the ('0', '0', 'all', '1', '0', '0' ) values? I looked at that section of the DB via phpMyadmin, but it was not clear how to do what was described. Thanks for any help.

vm’s picture

check the user table. do you have UID 0 ? which is the anon user role?

Milkrow’s picture

Sorry for the confusion folks. I'm very new to phpmyadmin and I was not aware that TRUNCATE means to EMPTY (it doesn't, but it does). I searched all over for the words TRUNCATE and could not find it. I added the values as prescribed and it didn't work. But then I got a friend to walk me through it and I learned that I first had to EMPTY the fields, then run the query. I also learned that perhaps one should not add the fieldnames with the GUI to the query field. Rather, I just pasted:

TRUNCATE node_access;

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

into the query box and hit GO. Couldn't be simpler? Neither could I. I hope this helps someone else who was somewhat mystified by phpmyadmin. Thanks for everyone's help on this...very thorough and thoughtful.

kapilrdave’s picture

OH GOSH! You are a true genius!! Without you nobody on the earth would have figured out this.

dpatte’s picture

I actually have this problem on the latest version 6.16

I have tried all the advice on this page, and others and still no luckl

I can log in and see my pages, but anonymous users see none.

Currently I have disabled EVERY ONE of my add-on modules to try to resolve this - but still no luck.

Any doeas?

vm’s picture

have you gone to administer -> post settings?
is there a button to rebuild the node access table?
have you checked your user table? is there a UID 0 in there? Does it match what is set in a default 6.x install for UID 0?

What, if any, access modules are in use?

bsmith451’s picture

is there a UID 0 in there?
I have multiple entries of the UID 0, I'm also getting flaky results. How may UID 0 records should/can I have?
I'm willing to backup and truncate the table, but I want to make sure that is ok to do. I have approx. 12 NID's with the GID 0

grandpalacko’s picture

If you tried all advice and still no luck: don't forget to clear your cache on Site configuration / Performance page.

camhoward’s picture

Thanks for this thread and all the helpful posts. I ran into this after changing the default access control settings in Menu Access Settings in the Menu Access module in Drupal 6.19. It certainly is unsettling to log out and see "Access denied" or the initial "Welcome to your Drupal web site" where the home page should be!

Here are the step-by-step directions I used based on notes posted here. I hope this helps folks who are new to Drupal and phpMyAdmin.

  1. Check User management > Permissions to ensure that node module > access content is checked for anonymous user
  2. Log into phpMyAdmin
  3. Click on your Drupal database in the left column
  4. Click on node_access (or drp_node_access in some installations) to view that table
  5. Click on the “Empty” tab to empty or TRUNCATE the table
  6. Click on the SQL tab
  7. Delete any content in the "Run SQL query/queries on database" field, and type: INSERT INTO node_access (nid, gid, realm, grant_view, grant_update, grant_delete) VALUES (0, 0, 'all', 1, 0, 0);
    • Note: in the INSERT INTO line, change node_access to drp_node_access if your Drupal installation uses this prefix
  8. Click “Go”
  9. Log into your site as User1 and clear all caches
  10. Log out and reload the page as an anonymous user
  11. All should be well again!