I have a problem on a server I manage. An account (specifically, my account) does not seem to have the correct groups. I think the problem is most easily demonstrated by looking at the following command sequence:
Last login: sometime from somewhere
user.x@srv:~$ groups
user.x
user.x@srv:~$ groups user.x
user.x : user.x grp1 grp2
user.x@srv:~$ su - user.x
Password:
user.x@srv:~$ groups
user.x grp1 grp2
user.x@srv:~$ exit
user.x@srv:~$ groups
user.x
So the problem is that the groups for user.x are incorrectly reported after logging in (through SSH). If logging in is simulated again (su -
) or the username is supplied with the groups
or id
command it works fine.
The incorrect groups cause all sorts of problems, like not being able to sudo. How can I fix this?
Further information that might be relevant:
- The server is a NIS client which synchronises every 15 minutes
- The problem is rare, but not unique, at the moment 2 users have acquired it in the last half-year
- The problem seems to only happen to users that SSH into the machine often
/bin/bash --login
instead ofsu -
?/bin/dash -l
/etc/profile
- see my answer.