Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Is there a module to set a password-protect per node for anonymous users? I'd like to protect some nodes to show it only to those who have the password, without having to create a user account. I've found one for Drupal 6 it has a 7 version but it doesn't have any non-dev releases. And there's another one for Drupal 7 but this one requires the user to register and paste the password to their user profile which is not what I need.

share|improve this question

4 Answers 4

up vote 6 down vote accepted

The best module for doing this in Drupal 7 is: Protected Pages:


It allows setting a password per path.

share|improve this answer

I've also tried the protected_node module for a similar project and haven't been able to get the 7.x development release to work as expected which is unfortunate since I haven't found another module that offers the same functionality -- most of the 'password protection' solutions are focused on protecting files, not individual nodes.

To get our project to work, we tried the custom solution suggested here on stackoverflow:


function theme_preprocess_node( &$variables )
    $allowed_roles = array("administrator", "media");

    global $user;
    if($variables['nid'] == NODEID)
        foreach($user->roles as $role)
            if(in_array($role, $allowed_roles))
        drupal_goto("user"); //  redirect to login

This would work best if you had a limited number of pages you wanted to protect and didn't need an interface to change or add these frequently. Short of that, the next best alternative is to try and push the development of the protected_node module in the issues queue.

share|improve this answer

I was able to get the protected_node 7.x-1.x-dev release to work, in this case password-protecting single nodes of type Basic Page, after some debugging and making 11 (yes, eleven) code changes. I found that the password entered when editing the node content was being double-encrypted due to a duplicate call to hook_node_update, and a quick solution was to remove the 11 calls to sha1(), disabling password encryption. The pros and cons of doing this are infinitely debatable, but it was an efficient way to meet both the need and a deadline. This buys some time until further debugging can be done, and hopefully it will help others.

share|improve this answer

Disclaimer: I am a contributor to the Protected Node module :) Also, the module is much more mature now than when this question was originally posed.

The Protected Node module you mention is what you are looking for. Don't discard it simply because of the dev-only status. In fact, they are close to an official release. The module maintainers are primarily focused on the D7 version, and there are over 1000 D7 sites using this module.

As far as Protected Pages, it works well but a page and a node are different concepts.

share|improve this answer
I asked this question 2 years ago, and only now they're very close to a RC. That's not what I was looking for at that time. –  Beebee Jul 13 at 8:57
@Beebee Right, I wanted to add this updated info now to help future searchers and to keep this question up to date. Plus, it answers the question :) –  digitgopher Jul 13 at 12:46
Cool, likewise I was just replying to "Don't discard it simply because of the dev-only status". I am quite ok using dev releases if they work more or less and patching them up if needed. –  Beebee Jul 13 at 12:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.