NFS home for multiple computers
Solution 1:
I've done a very similar thing for a MythTV system. Each diskless frontend machine netboots using DHCP PXE and TFTP. System is running Ubuntu 16.04 LTS. (IP 1.1.1.1 is the client machine and 2.2.2.2 is the server)
In /etc/dhcp/dhcpd.conf IP and hostname is assigned based on MAC:
group {
use-host-decl-names on; #forces hostname to host
host bedroom {
hardware ethernet 00:00:00:00:00:00;
fixed-address 1.1.1.1;
}
}
TFTP calls a mount script upon boot init, which mounts an NFS home based on the hostname. I used hostname for readability when browsing the folder structure; you could parse the MAC and use it for the folder name. TFTP pxelinux.cfg default file:
LABEL linux
DEFAULT vmlinuz-4.4.0-53-generic root=/dev/nfs initrd=initrd.img-4.4.0-53-generic nfsroot=2.2.2.2:/pxeroot init=/boot/mountscript.sh ip=dhcp rw
mountscript.sh:
#!/bin/bash
HOSTNAME=`hostname`
MOUNT_OPTS="rw,intr,async,bg,tcp"
mount -t nfs 2.2.2.2:/path/to/homes/home-${HOSTNAME} /home -O MOUNT_OPTS
exec /sbin/init </dev/console >/dev/console 2>&1
Also, /etc/exports has NFS export settings which map the required home folder to the unique static IP address:
/path/to/homes/home-bedroom 1.1.1.1(rw,async,insecure)
New homes folder and the NFS export entries for each new machine must be added manually.
Please note: this example applies to single-use, single-user machines that store some unique configuration info (IR commands for the TV it's attached to, mostly) in the home folder. It achieves your stated goal of a home folder per MAC, but I suspect that home folder per user is what you're actually looking for as joeqwerty mentions. This solution would not allow a user to log into any machine, and would require home folders to be created per-user, per-machine. That also means that without a messy web of symlinks, there'd be no easy way to access the same files on different computers.