[Pkg-shadow-devel] Bug#584868: Bug#584868: Bug#584868: passwd: userdel removes the group with the same name as 'username'

Christian PERRIER bubulle at debian.org
Tue Jun 8 05:00:54 UTC 2010


Quoting Teodor MICU (mteodor at gmail.com):

> Well, I guess you mised the part where the custom user 'staff' (by
> custom I mean created manually by me) does _not_ have the primary
> group 'staff' but a custom group 'partners' (ID=1000) thus these two
> are only related by the same name. My point is that 'userdel' must not
> try to delete a group that has the same name as the user being deleted
> _unless_ there is no other user belonging to this UPG.


Oh, right. In this case I do agree there's a problem. I reproduced
this:

root at mykerinos:~# addgroup partners
Adding group `partners' (GID 1003) ...
Done.
root at mykerinos:~# adduser --ingroup partners staff
Adding user `staff' ...
Adding new user `staff' (1002) with group `partners' ...
Creating home directory `/home/staff' ...
Copying files from `/etc/skel' ...
Entrez le nouveau mot de passe UNIX : 
Retapez le nouveau mot de passe UNIX : 
Aucun mot de passe fourni
Entrez le nouveau mot de passe UNIX : 
Retapez le nouveau mot de passe UNIX : 
passwd : le mot de passe a été mis à jour avec succès
Changing the user information for staff
Enter the new value, or press ENTER for the default
        Full Name []: 
        Room Number []: 
        Work Phone []: 
        Home Phone []: 
        Other []: 
Is the information correct? [Y/n] 
root at mykerinos:~# userdel -r staff
root at mykerinos:~# grep staff /etc/group
root at mykerinos:~#


So, *even though* "staff" was not member of "staff", the staff group
was deleted because the system uses UPG. Apparently, userdel
unconditionnally deletes the group of the same name than the user when
deleting the user *even though* the user is not (or no longer) member
of this group.

*that* is more a candidate for being called a bug.

The question that's coming then becomes:  should this behaviour be
prohibited in all cases or should the group removal be prohibited for
system groups only?

After all, let's imagine the situation where I once added a "bubulle"
user, with UPG activated on the system. That added a "bubulle" group
too.

For whatever reason, I later on changed the primary group for
"bubulle" to something else. Should I really expect that deleting
"bubulle" would then delete the "bubulle" grop *just because* it
shares the same name than the user?

The argument against being a bug is the same I sued: by changing
bubulle's PG from bubulle to something else on a system where UPG are
ON, I'm somewhat shooting in my own foot.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-shadow-devel/attachments/20100608/3876cda8/attachment.pgp>


More information about the Pkg-shadow-devel mailing list