System Networking BTS SIO labs
Centralised logins with NIS and shared homes over NFS
Create a user once, log in anywhere with the same password and the same home directory. NIS and NFSv4 between two unprivileged LXC containers, with every test written down.
- NIS
- NFSv4
- LXC
- AppArmor
The goal of this lab: create a user once on a server, then log in on any client with the same name, the same password and the same home directory. NIS distributes the accounts, NFS shares the homes. Two unprivileged LXC containers, and every result checked by a test.
Why bother with NIS in 2026?
NIS (formerly Yellow Pages) is old, and unencrypted: in production you would use LDAP or FreeIPA. But it shows the mechanics of centralised identity very plainly: maps of passwd, group and shadow served over RPC, picked up by the client through NSS and PAM. Once you have seen it work, LDAP makes a lot more sense.
Architecture
| Role | Container | Address | Services |
|---|---|---|---|
| Server | CT 102 nis | 192.168.1.102 | ypserv, yppasswdd, nfs-kernel-server |
| Client | CT 103 nis-client | 192.168.1.103 | ypbind, NFSv4 client |
Text version
CT 102 · nis (192.168.1.102) CT 103 · nis-client (192.168.1.103) ┌───────────────────────────────┐ NIS ┌──────────────────────────────┐ │ ypserv / yppasswdd │ ───────▶ │ ypbind → NSS → getent, login │ │ /var/yp/tp.nis (maps) │ │ │ │ │ NFS │ │ │ nfs-kernel-server /home │ ───────▶ │ /home (mount nfs4) │ └───────────────────────────────┘ └──────────────────────────────┘ NIS domain: tp.nis · Debian 13 · unprivileged LXC
Prepare the Proxmox host
Containers share the host kernel, so the NFS modules must be loaded on the host and kept across reboots:
modprobe -a nfs nfsd lockd
printf 'nfs\nnfsd\nlockd\n' > /etc/modules-load.d/nfs.conf
And the client container must be allowed to mount NFS at all. Without this, AppArmor blocks it with apparmor="DENIED" operation="mount":
pct set 103 --features "mount=nfs;nfs4,nesting=1"
pct reboot 103
NIS server (CT 102)
apt install -y nis rpcbind # asks for the NIS domain: tp.nis
echo tp.nis > /etc/defaultdomain && nisdomainname tp.nis
echo '192.168.1.102 nis.home.lan nis' >> /etc/hosts # the master must resolve its own name
NISSERVER=master
NISMASTER=nis
NISCLIENT=true
YPPWDDIR=/etc
YPBINDARGS="-local-only"Restrict who may query the maps. Without this, anyone who can reach the server can download the user list:
host 127.0.0.1
255.255.255.0 192.168.1.0The step that cost me the most time: the default Makefile does not build a shadow map. No shadow map, no password hashes on the client, and every login fails.
MINUID=1000 # only distribute real users
MINGID=1000
NOPUSH=true # single server, no slaves
all: passwd group shadow rpc services netid protocolsI kept a separate shadow.byname map instead of merging hashes into passwd, so the hashes are not mixed into the most widely read map.
/usr/lib/yp/ypinit -m # confirm "nis", Ctrl+D, y
systemctl enable --now rpcbind ypserv yppasswdd ypbind
ypcat passwd # users with UID ≥ 1000
After adding or changing a user later: make -C /var/yp to rebuild the maps.
NFS export (CT 102)
/home 192.168.1.0/24(rw,sync,no_subtree_check,root_squash)apt install -y nfs-kernel-server
exportfs -ra && systemctl enable --now nfs-server
exportfs -v
root_squash maps root on the client to nobody on the share, so a client admin cannot write anywhere in everyone's homes.
NIS and NFS client (CT 103)
apt install -y nis rpcbind nfs-common
echo tp.nis > /etc/defaultdomain && nisdomainname tp.nis
echo 'domain tp.nis server 192.168.1.102' > /etc/yp.conf
passwd: files systemd nis
group: files systemd nis
shadow: files systemd nis192.168.1.102:/home /home nfs4 rw,hard,_netdev 0 0systemctl enable --now rpcbind ypbind
mount -a
hard makes writes wait for the server instead of failing silently (safer for home directories), _netdev delays the mount until the network is up. The old intr option is obsolete and ignored.
Tests
Every claim gets a command. Here are the ones that matter, with what I saw.
| # | Test | Command | Result |
|---|---|---|---|
| 1 | Server daemons | systemctl is-active rpcbind ypserv yppasswdd nfs-server | all active |
| 2 | Client bound to server | ypwhich | 192.168.1.102 |
| 3 | User comes from NIS, not local | getent passwd testnis vs grep testnis /etc/passwd | found / empty |
| 4 | Authentication | su - testnis, good then bad password (as a non-root user) | OK / failure |
| 5 | Password change from the client | yppasswd | changed on server |
| 6 | Shared home | write on 103, read on 102 | same file, UID 1000 kept |
| 7 | root_squash | touch /home/x as root on 103 | permission denied |
| 8 | Reboot both | findmnt /home, ypwhich | back on their own |
| 9 | Server failure | systemctl stop ypserv, then ypmatch | fails, recovers on start |
Pitfalls worth knowing
No shadow map, no logins
Users resolve fine with getent passwd and still cannot log in. Add shadow to all: and rebuild the maps.
AppArmor blocks NFS in containers
The mount fails with a permission error that looks like an NFS problem. It is the container profile: features: mount=nfs;nfs4.
Modules belong to the host
modprobe inside a container does nothing useful. Load nfsd and lockd on Proxmox and persist them.
NIS is plain text
Hashes travel unencrypted and anyone allowed by securenets can read the maps. Fine for a lab on an isolated bridge, not acceptable on a real network.
What came next
The same accounts were then extended to Windows clients with a Samba domain controller, and the modern equivalent of the whole idea is the OpenLDAP lab.