Linux – NIS user not being added to NIS group

linuxnis

I have set up a NIS server and several NIS clients. I have a user and a group on the NIS server like so:

/etc/passwd:  myself:x:5000:5000:,,,:/home/myself:/bin/bash
/etc/group:   fishy:x:3001:otheruser,etc,myself,moreppl

I imported the users and groups on the NIS client by adding +:::::: to /etc/passwd and +::: to /etc/group.

I can log in to the NIS client, but when I run groups, fishy is not listed. But getent group fishy shows that it was imported correctly and lists me as a member. And if I do sudo su - myself, then suddenly groups says I am in the group!

I also had nscd installed, and the groups worked correctly for a while. It seemed like after being logged in for a while, I would silently be dropped out of the group. If I restarted nscd and logged in again, then the groups worked correctly…for a while.

There are no UID or GID conflicts with local users or groups.

Update: Contents of /etc/nsswitch.conf:

passwd:         compat
group:          compat
shadow:         compat

hosts:          files nis dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis
aliases:        nis files

Best Answer

I don't remember where I found the solution for this, but I was able to solve it by adding "nis" to the "group" line in /etc/nsswitch.conf:

passwd:         compat
group:          compat nis
shadow:         compat
Related Topic