Re: Bug#621833: System users: removing them
On Sun, May 29, 2011 at 12:04:35PM +0100, Roger Leigh wrote:
> I'm currently using this logic (in postinst)
>
> # Create dedicated sbuild user
> if ! getent passwd sbuild > /dev/null; then
> adduser --system --quiet --home /var/lib/sbuild --no-create-home \
> --shell /bin/bash --ingroup sbuild --gecos "Debian source builder" sbuild
> fi
>
> However, consider that if the account is locked, the user already
> exists and no unlocking will occur, leaving the reinstalled
> package broken. This logic is common to many packages.
That's a bug in a lot of packages, yes. adduser has been designed to
allow adduser --system to be called without that logic:
If called with one non-option argument and the --system option, adduser
will add a system user. If a user with the same name already exists in
the system uid range (or, if the uid is specified, if a user with that
uid already exists), adduser will exit with a warning. This warning can
be suppressed by adding "--quiet".
So, just remove the extra getent passwd check and you should be fine.
Greetings
Marc
--
-----------------------------------------------------------------------------
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 31958061
Nordisch by Nature | How to make an American Quilt | Fax: *49 621 31958062
Reply to: