Reset your MediaWiki Sysop Password

When you’re stuck without sysop access to MediaWiki because you cannot remember the sysop details then there’s a handy maintenance script that’s available (if you’ve used the package manager) to reset the sysop username and password.

On Ubuntu server you can run the following command:

php /usr/share/mediawiki/maintenance/changePassword.php --user=sysop --password=password

The script will immediately reset your sysop username and password with what you have entered above.

Now you can log in without any problems!

Some Useful Ubuntu Commands

Here’s a useful guide for some IT people that are getting into Linux, and more specifically Ubuntu.

Basically, it’s a reference for Windows users to do Linux-type commands. I’ll be adding to this post as time goes on.

Shell Commands

sudo -i set the command shell to have root privileges

Networking Commands

ifconfig shows network information (ipconfig in Windows)

ifdown eth0 && ifup eth0 restart your network adapter and get new IP address

ifconfig eth0 192.168.99.14 netmask 255.255.255.0 up change your IP address

route add default gw 192.168.99.254 set the default gateway

System Commands

init 0 shutdown

init 6 reboot

dmesg print diagnostic messages from the kernel

Disk tools

df Show a summary of disk usage

du Show a directory tree space usage (some nice modifiers in this :) )

tune2fs Allows you to modify disk and filesystem settings. Useful for removing reserved disk space on ext filesystems.

Services

invoke-rc.d service restart Start / Stop a service

update-rc.d service defaults 99 Add service to startup scripts

Flash

sudo dpkg-reconfigure flashplugin-installer Reinstall Adobe Flash

Other

uname -a and cat /etc/issue to know what version and distro of Linux you are running

Access VirtualBox SSH and Web Server

One of the thing that differs VirtualBox from Microsoft’s Virtual PC is that VB puts guest on a subnet of the computer that you are working on. This means that it cannot be directly accessed from other computers on your network.

To enable access, you need to configure your computer to allow ports to be forwarded to the guest. Thankfully, this is quite straightforward with the VBoxManage tool, and Allister Sanchez covers it well here: Additions and SSH Access to a VirtualBox Guest.
I’m assuming that your Vitual Machine is called MyVBoxSystem. Replace this with the name of your VM.

To enable SSH:

On the host computer, run the following commands:

<code>VBoxManage setextradata MyVBoxSystem "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 22
VBoxManage setextradata </code><code>MyVBoxSystem</code><code> "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
VBoxManage setextradata </code><code>MyVBoxSystem</code><code> "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP
</code>

This is essentially telling VirtualBox to map any access on port 22 (the host port) to 22 on the guest. On a Windows system, this is fine as you are unlikely to be running an ssh server. If you are though, just change the HostPort parameter to a port that you know is free.

To enable HTTP:

<code>VBoxManage setextradata </code><code>MyVBoxSystem</code><code> "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/HostPort" 80
VBoxManage setextradata </code><code>MyVBoxSystem</code><code> "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/GuestPort" 80
VBoxManage setextradata </code><code>MyVBoxSystem</code><code> "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/Protocol" TCP</code>

Once again, we’re passing TCP ports forward. If you already have a web server installed such as Apache or IIS, then you will probably need to change the HostPort to something like 8080.

Make sure that your VM isn’t running when you run these commands. To check that the settings are saved, you can run the following command:

<code>VBoxManage getextradata MyVBoxSystem enumerate</code>

Alternatively, open up the VM .xml file which is found in .VirtualBox/Machines/MyVBoxSystem/MyVBoxSystem.xml. The settings are found in the ExtraData node:

&lt;ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/HostPort" value="8080"/&gt;
&lt;ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/GuestPort" value="80"/&gt;
&lt;ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/Protocol" value="TCP"/&gt;
&lt;ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" value="222"/&gt;
&lt;ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" value="22"/&gt;
&lt;ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" value="TCP"/&gt;

Installing Ubuntu 8.04 server on VirtualBox

I had a little trouble running Ubuntu server on VirtualBox today.

Thankfully the answer was easily found at Installing Ubuntu 8.04 server on VirtualBox « {S.A.Z.W.Q.A}.

All you need to do to get Ubuntu server firing up is to open the settings screen for your virtual machine, and then tick the Enable PAE/NX box.

Click OK and fire it up! No problem.

Install vim on an Ubuntu server and desktop

I’ve grown quite fond of vim over the past couple of weeks. After learning and re-learning the shortcut keys, I think that I’m finally on my way to knowing what the hell I am doing!

Anyway, after working on it – I’ve found gVim to be great.

To install, just run:

<code>sudo apt-get install vim-full</code>

This includes syntax highlighting and other neat stuff. If you want to gegt the syntax highlighting on the server, just run:

<code>sudo apt-get install vim</code>

Yes, that’s right – no extra bits.

Mounting a remote system with SSH

One of the cool things I’ve been doing lately is using secure shell to mount remote file systems. The great thing about this method is that you’re not dependant of explicitly creating shares as you are in Samba, and you don’t have to rely on repeated scp commands.

As long as you have the sshfs package installed, you should be able to mount the file system. Here’s an example to create a mount point on your desktop:

<code>mkdir ~/Desktop/sshmnt
sshfs user@target-pc:/home ~/Desktop/sshmnt/</code>

That’s it! Once finished you can unmount the folder with the fusermount command:

<code>fusermount -u ~/Desktop/sshmnt</code>

If you have trouble with unmounting a connection (because the target may be switched off), you can force the connection to be unmounted:

<code>fusermount -z -u ~/Desktop/sshmnt</code>