My ongoing experiences with Ubuntu, and later Mythbuntu, as a media center with MythTV. I'm also using the system for a virtual machine server, a mediawiki server and a general all around home infrastructure base.

Saturday, March 17, 2007

Securing Mediawiki

I noticed that mediawiki was allowing anonymous editing of pages. I wanted to lock it down so that only those I grant accounts to could edit it.

I found the directions here. Which work for the most part, with some tweaks...

I started by restricting the wiki so that users had to be logged in to edit. That went fine.

Then I wanted to give myself sysop privileges. This was more complicated. The big issue is that when I installed mediawiki, I specified a prefix for my mediawiki tables:
$ grep wgDBprefix /etc/mediawiki/LocalSettings.php
$wgDBprefix = "mw_";
So I had to prefiex "mw_" to all the table names on the page. The specific steps were:
  1. First, I had to figure out what version of mediawiki I was running. Fortunately there is a Special:Version page that tells you that.
  2. Now I need to figure out my uid for the 1.4 comments. the best way I found to do that was to log into the mysql database and then issued the following command. From the output I was able to figure out my uid was '2'.
    mysql> SELECT user_id, user_name from mw_user;
  3. Now I could issue the command on the page:
    mysql> UPDATE mw_user_rights SET ur_rights="bureaucrat,sysop" WHERE ur_user=2;
    Query OK, 1 row affected (0.00 sec)
    Rows matched: 1 Changed: 1 Warnings: 0
That did it. I didn't even have to log out and back into the wiki.
Post a Comment