Password protect wiki pages.


If you have hosted your Mediawiki package on some hosting server and want to put some access read/write security, then here is a solution which doesn’t need you to play with Apache.

Put these lines in your LocalSettings.php file

$wgGroupPermissions[‘*’][‘edit’] = false;
$wgGroupPermissions[‘*’][‘read’] = false;

Now, an anonymous user wont be able to read any pages, except for the ones you explicitly white list, like this:

$wgWhitelistRead = array( “Special:Userlogin”, “-”, “MediaWiki:Monobook.css”, “Main_Page” );

The above like may already exist in your LocalSettings.php, just add pages you want anonymous users to see. If you don’t even want them to see your wiki front page, remove “Main_Page” from this list. Visitors will now be asked to log in immediately, even before they get to see your front page.

Unfortunately, by default Mediawiki lets users create their own accounts and this would mean that anonymous visitors can just create an account and have all the privileges you didn’t want them to have.
Protect your wiki against account creation by adding this line to LocalSettings.php:

$wgGroupPermissions[‘*’][‘createaccount’] = false;

Be aware that now legitimate new users cannot create their own accounts either, (but that problem also existed with the mod_auth_mysql approach).

There is a way for wiki admin users to create new accounts though:

* Go to the Special:Userlogin page (after logging in as an admin)
* Click “Create an account”
* Fill in the form, uncheck the box “Remember my login on this computer”
* Click “by e-mail”

The new user gets an e-mail with a generated password (I found out the password I typed in the form was discarded).
After logging in for the first time, the new user is asked to choose a new password.

Also there are many extensions like Simple security which may solve the purpose of securing pages.

Advertisements

About Abhinav Goyal
Will be updated soon.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: