[PATCH] 2nd attempt at deluser/delgroup size reduction and improvements
Denys Vlasenko
vda.linux at googlemail.com
Sun Nov 7 23:50:01 UTC 2010
On Monday 08 November 2010 00:42, Tito wrote:
> > > 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
Ok, you are right about this.
I am still puzzled why "Warning: group `prova' has no more members"
message appears.
Can you do another experiment: as above, but delete user prova's
record in /etc/passwd by hand:
adduser prova
adduser prova2 --ingroup prova
echo "prova2:x:1234:" >> /etc/group
sed '/^prova:/d' -i /etc/passwd
grep prova /etc/passwd /etc/group
deluser prova2
grep prova /etc/passwd /etc/group
--
vda
More information about the busybox
mailing list