NIS HOWTO: why NIS is obsolete and how to replace it
NIS (Network Information Service, once called Yellow Pages or YP) shares user accounts, groups, host names and automount maps across Unix machines. It dates from the 1980s, sends everything in clear text, and lets anyone who knows the domain name read your password hashes. Red Hat removed it from RHEL 9. If you still run it, the job today is to replace it with FreeIPA or LDAP plus SSSD, and to lock it down until you have.
The classic NIS(YP)/NYS/NIS+ HOWTO is kept by the Linux Documentation Project at tldp.org for reference. This page is about getting off NIS safely, as of November 2026.
Why NIS has to go
- Maps are readable by anyone who can reach the server. The ypserv(8) manual says that any remote user who knows your NIS domain name can issue an RPC to
ypservand retrieve your maps. That includespasswd.bynamewith its password hashes, which can then be cracked offline. - No encryption or real authentication. Clients trust whichever server answers, and all traffic is plain text.
- Open by default. Without a securenets file, ypserv answers any host. Debian’s packaged
/etc/ypserv.securenetseven ends with lines that give access to everybody, with a comment asking you to adjust them. - RPC and rpcbind. NIS needs the portmapper and dynamic ports, which are hard to firewall.
Where NIS still exists
| Distribution | Status |
|---|---|
| RHEL 9 and 10 (and Alma, Rocky) | Removed: nss_nis, yp-tools, ypbind and ypserv. Red Hat says there is no direct replacement and recommends Identity Management (IdM, based on FreeIPA) with SSSD. RHEL 10 IdM also dropped its NIS server emulator. |
| Fedora | Still packages ypserv and ypbind |
| Debian 13 / Ubuntu | Still packaged: nis, ypserv, yp-tools, libnss-nis |
So a mixed network can keep NIS alive for a while on Debian or Fedora, but every RHEL-family machine you upgrade loses its NIS client. Plan the move before the next upgrade cycle.
Pick the replacement
| Option | What you get | Fits when |
|---|---|---|
| FreeIPA / RHEL IdM | 389 Directory Server, MIT Kerberos, a certificate authority (Dogtag), optional DNS, host-based access rules, sudo rules, automount maps; clients join with ipa-client-install | Mostly Linux networks, especially with RHEL or Fedora servers |
| OpenLDAP or 389 Directory Server + SSSD | A plain LDAP directory; you add Kerberos and policy yourself | You want a small, standards-only directory or already run LDAP |
| Active Directory or Samba AD + SSSD | Accounts shared with Windows machines | Mixed Windows and Linux networks |
On every client, SSSD (System Security Services Daemon) replaces ypbind: it fetches users and groups, caches them for offline use, and handles Kerberos or LDAP logins. Setup for each option is in the LDAP HOWTO.
Migration plan
- Inventory. On a NIS client, list the maps the master serves and dump each one:
ypwhich # which server this client uses ypwhich -m # every map and its master ypcat passwd > nis-passwd.txt ypcat group > nis-group.txt ypcat -k netgroup > nis-netgroup.txt ypcat -k auto.master > nis-auto.master.txt-kprints the keys too, which matters for netgroup and automount maps. - Build the new directory and keep every UID and GID exactly as it was. Files on NFS servers and local disks store numbers, not names; changing a number orphans the files.
- Import groups, then users. Red Hat’s published NIS migration procedure loops over
ypcatoutput and callsipa group-add … --gid=andipa user-add … --uid= --gidnumber= --gecos= --homedir= --shell=. A safe way is to generate the commands into a file, read it, then run it with Bash (the%qquoting is Bash syntax):
For a plain LDAP directory, write the same fields into LDIF entries with theypcat passwd | while IFS=: read -r name hash uid gid gecos home shell; do [ "$uid" -ge 1000 ] || continue printf 'ipa user-add %q --first=NIS --last=User --uid=%q --gidnumber=%q --gecos=%q --homedir=%q --shell=%q\n' \ "$name" "$uid" "$gid" "$gecos" "$home" "$shell" done > import-users.sh less import-users.sh kinit admin bash import-users.shposixAccountobject class instead. - Passwords. NIS stores old
crypt()hashes, and they cannot be converted. Red Hat notes that Directory Server does not convert existing hashes. Give users temporary passwords that must be changed at first login (ipa passwd alice), or have them set one through a self-service page. Do not lower the directory’s password storage scheme to weak crypt just to accept old hashes. - Automount and netgroups. Recreate
auto.masterand its maps as IPA automount maps or LDAP automount entries, and netgroups as IPA netgroups or LDAPnisNetgroupentries. Red Hat advises using theipa netgroup-*commands only for netgroups you created withnetgroup-add. - Move clients one at a time. Join each client (
sudo ipa-client-install --mkhomedir, or configure SSSD for LDAP), then change/etc/nsswitch.conffromnistosss:
On Fedora and RHEL,passwd: files sss group: files sss netgroup: files sss automount: files sssauthselect select sssdwrites this for you. Test withgetent passwd alice,id aliceand a real login, then stopypbindon that client. - Freeze, then switch off. When the last client has moved, make NIS read-only for a few weeks as a fallback, then stop
ypserv, remove the packages, and close the RPC ports.
Test with one account first. Create a single test user in the new directory with a UID that does not exist in NIS, join one spare client, and check login, home directory, sudo and NFS access before you import everybody.
If you must keep ypserv running for now
Reduce the damage while the migration runs:
- Restrict clients with securenets. The file holds netmask and network pairs (or
hostand one address), and only IP addresses. It is/var/yp/securenetsper the upstream manual and/etc/ypserv.securenetson Debian. Delete the “access to everybody” lines from Debian’s default:255.0.0.0 127.0.0.0 host ::1 255.255.255.0 192.168.10.0 - Pin the port and firewall it.
ypserv -p(or--port) binds a fixed port so that a firewall can allow it only from the NIS subnet. Block NIS and rpcbind (port 111) at every network edge. - Keep the domain name private and different from your DNS domain; it is the only “secret” NIS has.
- Isolate it. Put the NIS server and its clients on their own VLAN. Never expose NIS over Wi-Fi guest networks or VPN pools.
- Set a deadline. Every month on NIS is another month in which a copy of your password hashes can leak.
Sources
- Identity management changes in RHEL 9 (NIS packages removed), Red Hat documentation
- Identity management changes in RHEL 10 (NIS server emulator removed), Red Hat documentation
- Migrating from NIS to IdM, RHEL 7 Linux Domain Identity guide, Red Hat documentation
- ypserv(8), Debian 13 manual pages
- Debian ypserv packaging (securenets template and install path), sources.debian.org
- ypcat(1), Debian 13 manual pages
- ypwhich(1), Debian 13 manual pages
- nis package, Debian 13
- ypserv package, Fedora Packages
- About FreeIPA, freeipa.org
- ipa-client-install(1), Debian 13 manual pages