Ubuntu

You are currently browsing articles tagged Ubuntu.

KeePass is a free and utterly genius password management tool that has allowed me to leave the days of reusing passwords way in the past. Now all of my passwords are different, securely managed, and look something like “út8¥Äbë¬eqö«ûëU^Èm­¯”. (Go ahead — try to guess it!) It was written in Microsoft .Net, and supposedly works just fine under Mono in Linux. Mono is a .Net compatibility layer and it’s already included in Ubuntu installations. Well, most of it is.

The problem is that it didn’t quite work out of the box on our Ubuntu 10.10 machine. In particular, I wasn’t able to connect to my password database via FTP like I usually do, but I solved a couple other common problems along the way as well.

First, download the portable version KeePass from the site’s download page, and move all the files onto your linux box. I put them in my home directory under a new hidden directory called “.KeePass”. The first thing I did was add an application launcher to Ubuntu’s top panel, and lo and behold it would not launch.In console, I saw this error message:

The assembly mscorlib.dll was not found or could not be loaded. It should have been installed in the `/usr/lib/mono/1.0/mscorlib.dll’ directory.

The problem was simple; there was a typo in the path. So be sure to type the path carefully, like this: “mono /home/myname/.KeePass/KeePass.exe”. When Mono can’t find the file, it decides it wants to try to run an older version of itself, and that older version it’s included in Ubuntu by default.

Next there were a couple of errors that I wouldn’t have gotten if I had read the instructions carefully. They were both the standard “assembly not found” errors with the text “The following assembly referenced from /home/myname/.KeePass/KeePass.exe could not be loaded” and “The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly.” The first referred to “System.Windows.Forms” and the next to “System.Runtime.Remoting”.

These assemblies were simply not installed in Ubuntu 10.10 by default, but they’re available in the Ubuntu Software Center. Here’s what they look like when you’re adding them.

Adding Mono System.Windows.Forms Support

Adding Mono System.Windows.Forms Support

Sorry about the overlaid screen shot window in this one, but you can still see how to filter and what to click.

Adding Mono System.Runtime Support

Adding Mono System.Runtime Support

Finally it would run, but I was still unable to from open the database from the URL of the FTP site. When I tried either by opening it directly or tweaking the config file, I got a polite error from KeePass that said, “The requested feature is not implemented.” I recognize this as a System.NotImplementedException that’s trapped (but probably not expected) in the code. What it probably means is that KeePass uses some features of .Net that are not yet implemented in Mono; it’s not KeePass’s fault.

I saw two ways around this error: First I could mount the FTP site to a local path using curlftpfs, but that would mean installing something new. Instead I wrote a short shell script to download the database, launch KeePass, and then upload the database back to the FTP site. Here’s the content of the script:

  Server="ftp://my_ftp_site.com"
  User="my_ftp_username"
  Password="my_password"
  DBFile="database.kdbx"
  LocalPath="$HOME/.KeePass/"

  lftp -u $User,$Password $Server <

Finally, I made the script executable, remapped the launcher to the script, picked a better icon, and I was in business again. I hope someone else out there finds this helpful. I know I will the next time I forget what I did. :)

I have a Synology DiskStation (DS209j) that I use on a primarily Windows network, but in some cases I want to access the DS shares from Ubuntu virtual machine running inside VirtualBox. There’s no sense mounting them as Windows shares with the DS supports NFS, so I went that route in stead. (Besides, some application still have trouble with Samba shares.)

I was scratching my head over a “access denied by server while mounting” error until I realized that VirtualBox was getting in the way. Here are the steps I took to get it up and running properly:

  1. In the VirtualBox menu of the virtual machine , select Devices > Network Adapters… and choose Bridge Adapter instead of the default NAT. This takes your virtual machine out of the private network it has with the host computer and makes it a first-class citizen on the network your host computer is on, with its own IP address.
  2. Check the guest machine’s IP address by opening Applications > Accessories > Terminal and typing “ifconfig”. It will probably start with “192.168”, but you’ll need all four parts if you want to limit access to just that machine.
  3. Log into Synology DiskStation Manager as admin, and click Management.
    1. Under Information, click Status and note the network IP address of your DiskStation. It will probably start with “192.168”, but you’ll need all four parts of the IP address.
    2. Under File Sharing, click NFS, and make sure it’s enabled.
    3. Under Privileges, click Shared Folder. Select the folder one you want to mount using NFS, and click NFS Privileges at the top of the list to add a new privilege. Use the IP address of the guest machine to lock access down to that specific machine, or use wildcards to allow access accross your local network (e.g. “192.168.*.*”).
    4. Before you close the NFS Privileges window, note the “Mount path” at the bottom of the list. It will probably look something like “/volume1/MyShare”
  4. To automatically mount the NFS share when you start up, go back to the Terminal window on the guest machine.
    1. Create a directory to use as a mount location. For example if you want to use “MyDSData” in your home folder, type “sudo mkdir /home/YourUserName/MyDSData”. Enter your password when prompted.
    2. Type “sudo gedit /etc/fstab” in the same Terminal window, and edit then add the line below  line to the end of the file. (It’s all one line.) Instead of “[DS IP Address]” use the IP address of your Synology DS, instead of “[Mount path]” type the mount pah, and instead of [Mount location] type the directory you made above. Don’t leave out the colon or the spaces.

      [DS IP Address]:[Mount path] [Mount location] nfs rw,hard,intr,nolock,nfsvers=3 0 0

      For example: “192.168.1.42:/volume1/MyShare /home/alex/MyDDData nfs rw,hard,intr,nolock,nfsvers=3 0 0”

First, create a shared folder using the VirtualBox user interface. For this example, we’ll call it “Data”. Launch Ubuntu.

From within Ubuntu, launch Application > Accessories > Terminal, and at the prompt type

sudo gedit /etc/fstab

Enter your administrative password, and you’ll see a text editor window appear with the fstab file loaded. Add the following single line to the end of the file, but replace “username” with your actual username.

Data /home/username/MyData vboxsf defaults,rw,uid=1000,gid=1000 0 0

Click “Save” and then restart Ubuntu.

Once restarted, go to Places > Home Folder and note the new MyData folder. This is your shared fol