Friday 4 January 2008

Joining a Ubuntu / Kubuntu machine to an NIS domain with NFS shared home

Over the past few years, I have usually used Debian as my Linux distro of choice. The server on which our users are set up is sharing the login details with NIS and the home directories are shared by NFS.

This are then picked up by other servers such as our mail server and our LTSP server.

Having tried Kubuntu (the KDE based version of Ubuntu) for a while, I'm considering moving our LTSP server to that distribution as the user facing packages are all more up to date than you get with Debian.

There's a couple of "gotchas" in doing this.

First off, Ubuntu uses sudo rather than letting you log on directly as root. This means that you are always first of all logged on as a real user - who is then using files on /home - meaning that you can't easily NFS mount /home.

My solution to this was to boot to recovery mode which does give you a shell as root, then move /home to /localhome and amend /etc/passwd accordingly for the local user that was created during setup. Incidentally, I also made sure that this local user was not the same name or ID as any users that our main server has.

Next you install the nis stuff - and here's where the networking becomes interesting. The Network Manager doesn't bring the interface up properly once you're joined to an NIS domain - unless you explicitly set the interface to be "auto" - so /etc/network/interfaces looks like:

auto lo
iface lo inet loopback
address 127.0.0.1
netmask 255.0.0.0


iface eth0 inet dhcp

auto eth0


This ensures that the interface comes up before the machine attempts to join the NIS domain and so it is able to do so.


You then do the usual adding of +:::::: to /etc/passwd and similar to /etc/shadow, /etc/group and /etc/gshadow and the users become visible.

Add a suitable NFS mount for /home and lo and behold they can log in and see their files.