Stranger in a strange land: Linux in a Windows-dominated workplace

Here at Numiko towers we are approximately 60/40 Windows and Mac users. But I am the only Linux user. This post is about getting Linux (Ubuntu) to play nicely in a (mostly) Windows-dominated workplace.

When I joined Numiko (almost 2 years ago), I was offered a choice of platform for my development machine – Windows, or Mac. In my previous life as a freelancer I had become used to using Ubuntu daily and, when I mentioned this, I was delighted to be told that Linux could be an option as well.

The following are some instructions I wrote in case other brave souls wish to embark on this (not too difficult) journey.

Local DNS server

The first task after installing Ubuntu was to get my machine to recognise the local DNS server. To do this, add a line to /etc/network/interfaces:

dns-nameservers xxx.xxx.xxx.xxx

Using the IP address of the server. If the file doesn't exist yet, just create one.

Local domain

In order to use local URLs, you will have to disable the avahi-daemon, which is an implementation of the Zeroconf protocol and is compatible with Apple services.

Ubuntu uses Upstart as a replacement for sysvinit to launch system processes on startup. Create an upstart override in /etc/init with the following command:

sudo sh -c "echo manual > /etc/init/avahi-daemon.override"

You will need to restart the computer for it to take effect (killing avahi-daemon won't work as its script contains a respawn command).

Thunderbird Mail Client

Thunderbird is my preferred Linux email client. To get it to work with Microsoft Exchange Server, download and install the ExQuilla extension for Thunderbird, then follow the post install instructions.

Add the Lightning plug-in to enable Outlook calendar invites and events.

To start Thunderbird on login:

sudo ln -s /usr/share/applications/thunderbird.desktop /etc/xdg/autostart/

(of course you can do the same with other applications you want to start automatically)

Mount shared network drives

You can create shortcuts in Nautilus by browsing the network to the desired folder, then choosing Bookmarks->Add Bookmark from the menu. This is fine if you just want to browse the files using Nautilus, but shortcuts probably won't be visible to other programs - your IDE's File->Open dialogue, for example. If you want these applications' file dialogues to recognise these file systems, you will have to mount them permanently.

If you have Linux servers that aren't running nfs, an option is to map them as Windows shares as well.

I originally used the method described here to mount windows shared network drives permanently. I have included the original steps for interest, but read on to find out why I later changed approach.

Install CIFS (formerly Samba)

sudo apt-get install cifs-utils

Create (empty) target directories. I put mine under /media

cd /media
sudo mkdir share1
sudo mkdir share2
...

Using a text editor, create a file in your home(~) directory for your logon credentials to the remote servers.

vim ~/.smbcredentials

This is just a text file, and it should be in the format:

username=value
password=value
domain=value

(tip: if you are mounting shares from multiple servers, create a separate credential file for each server e.g. .share1creds, .share2creds, etc. If you change your password on any of the servers, remember to change it in the corresponding credentials file.)

Protect the file(s) from prying eyes:

chmod 600 ~/.smbcredentials

Edit (with root privileges) the /etc/fstab file, adding a line in the following format for each target directory:

//servername/sharename /media/share1 cifs credentials=/home/ubuntuusername/.smbcredentials,iocharset=utf8,noperm 0 0

(substitute your details as required)

Test with the command:

sudo mount -a

If everything works, your remote shares should be available immediately. They should also mount automatically on reboot.

Mount shared network drives (Take 2)

I gave up on mapping network drives using fstab because, over the course of a day, Nautilus was gobbling up all the cycles (probably continually polling to detect any changes). A better way (IMO) is to use SSHFS and RSA keys for passwordless login.

#! /bin/bash
ssh-add ~/.ssh/share1_rsa
sshfs server1.local.path:/ /media/share1
ssh-add ~/.ssh/share2_rsa
sshfs server1.local.path:/ /media/share2
...

(again, substitute your details as required)

Finally, make the script executable and set it to run on startup. Job done!

In conclusion

I have been using this setup for almost 2 years now with very few issues. Minor niggles have been:

  • Version control GUIs didn't work (I haven't tried recent versions) across shared drives. This is not a problem, as I prefer the CLI anyway.

  • Replies to calendar invites in Lightning are not being delivered, Although my status on the event is showing correctly.

Apart from that, it's been a nice ride.