[PATCH] 2nd attempt at deluser/delgroup size reduction and improvements
Tito
farmatito at tiscali.it
Sun Nov 7 23:42:01 UTC 2010
On Sunday 07 November 2010 23:44:24 Denys Vlasenko wrote:
> On Sunday 07 November 2010 18:44, Tito wrote:
> > > > > > adduser prova
> > > > > > Adding user `prova' ...
> > > > > > Adding new group `prova' (1006) ...
> > > > > > Adding new user `prova' (1004) with group `prova' ...
> > > > > > adduser prova2 --ingroup prova
> > > > > > Adding user `prova2' ...
> > > > > > Adding new user `prova2' (1005) with group `prova' ...
> > > > >
> > > > > And what grep prova /etc/passwd /etc/group shows
> > > > > after these?
> > >
> > > I need an answer to the above question.
> >
> > /etc/passwd:prova:x:1004:1006:,,,:/home/prova:/bin/bash
> > /etc/passwd:prova2:x:1005:1006:,,,:/home/prova2:/bin/bash
> > /etc/group:prova:x:1006:
>
> Thanks. Ok, it's like I expected.
>
>
> > > I dont believe it looks for a group with the same name.
> > > I think it looks for a group with the GID found in
> > > deleted user's passwd line.
> >
> > I think I can demostrate it does:
> >
> > /etc/passwd:prova:x:1004:1006:,,,:/home/prova:/bin/bash
> > /etc/passwd:prova2:x:1005:1006:,,,:/home/prova2:/bin/bash
> > /etc/group:prova:x:1006:
>
> In order to check my theory, you should add (say, by hand)
> another line to /etc/group:
>
> prova2:x:1234:
>
> and _then_ run "deluser prova2".
>
>
> > Now let's remove user prova2:
> >
> > deluser prova2
> > Removing user `prova2' ...
> > Warning: group `prova' has no more members.
> > Done.
> >
> > And check:
> >
> > /etc/passwd:prova:x:1004:1006:,,,:/home/prova:/bin/bash
> > /etc/group:prova:x:1006:
> >
> > group was not removed as not matching username.
>
> I think that group was not removed because another user
> (prova2) exists who has primary GID=<primary GID of prova2>.
>
> Can you repeat the experiment, but with artificially added
> prova2 group, as described above?
>
Hi,
so here we go:
adduser prova
Adding user `prova' ...
Adding new group `prova' (1006) ...
Adding new user `prova' (1004) with group `prova' ...
adduser prova2 --ingroup prova
Adding user `prova2' ...
Adding new user `prova2' (1005) with group `prova' ...
echo "prova2:x:1234:" >> /etc/group
grep prova /etc/passwd /etc/group
/etc/passwd:prova:x:1004:1006:,,,:/home/prova:/bin/bash
/etc/passwd:prova2:x:1005:1006:,,,:/home/prova2:/bin/bash
/etc/group:prova:x:1006:
/etc/group:prova2:x:1234:
deluser prova2
Removing user `prova2' ...
Warning: group `prova' has no more members.
Done.
grep prova /etc/passwd /etc/group
/etc/passwd:prova:x:1004:1006:,,,:/home/prova:/bin/bash
/etc/group:prova:x:1006:
Looks to me it is removed by name
Ciao,
Tito
More information about the busybox
mailing list