TrueCrypt Autorun Script for USB

You can easily create an Autorun file on a USB pen drive to mount and dismount the encrypted file systems. This is very useful for carry portable TrueCrypt USB drives.

The only downside is that using TrueCrypt on the move means that you need administrator rights to access the disk.

Once you plug in the USB stick, you should see the typical Windows menu pop up. You can also right-click on the drive icon to mount, dismount and run the truecrypt application.

AUTORUN.INF

[autorun]
label=MyData
icon=truecrypt.exe
<code>
action=Mount TrueCrypt Volume
open=truecrypt /v MyData.tc /li /q /a /m rm /e</code>
<code>
shell=mounttc
shell\mounttc=&amp;Mount
shell\mounttc\command=truecrypt /v MyData.tc /li /q /a /m rm /e</code>
<code>
shell=dismounttc
shell\dismounttc=Dismount
shell\dismounttc\command=truecrypt /di /q</code>
<code>
shell=runtc
shell\runtc=Run TrueCrypt
shell\runtc\command=truecrypt</code>

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.

USB Working in Virtual 2.0.4 on Ubuntu Ibex Intrepid 8.10

After upgrading to Ibex, I found that I couldn’t sync my Palm with my Windows XP guest.

After trudging through different websites with contradictory solutions I stumbled on this, which works a charm:

Open the terminal and type
vbox /etc/group

You should end up with something like

vboxusers:x:124:john

Make a note of the group ID (124 in this case). Now run
sudo gedit /etc/init.d/mountkernfs.sh

Find this section

#
# Mount proc filesystem on /proc
#
domount proc "" /proc proc -onodev,noexec,nosuid

Below this, copy the following code:

#
#Mount USB file system
#
domount usbfs "" /proc/bus/usb usbdevfs -onoexec,nosuid,nodev,devgid=XXX,devmode=664

Replace XXX with the group ID from above.

Save and quit. Reboot the system. The next time you run VirtualBox, you should be able to see the USB devices and use them.

Getting that SQL Server 2008 to Work out of the box

I had to set up a new SQL Server database, which I haven’t done in a while as I tend to focus my efforts on mySQL. Nevertheless I needed to get grip on a new site to migrate.

After setting most things up, I managed to get to a point where the database wasn’t starting.

Microsoft OLE DB Provider for SQL Server error ‘80004005’

[DBNETLIB][ConnectionOpen (PreLoginHandshake()).]General network error. Check your network documentation.

I really love unhelpful messages. Anyway, after some head scratching I found an article on on the Microsoft Forums from a chap with a similar issue.

To fix the problem, I loaded up the SQL Server Configuration Manager, and expanded SQL Server Network Configuration. Under Protocols for MSSQLSERVER (this is the instance name of the server), I enabled TCP/IP. The error went away. Tada!

I suppose it would help to read the documentation thoroughly – but I got to where I needed to be anyway. I imagine that it makes sense to disable TCP/IP connections until you’re happy that the server is secure. Even so, I was making connections from the localhost, so I would have expected it to work.