[Adduser-devel] Bug#248500: Bug#248500: adduser: do not re-use uids used once

Pepe pepe at naleco.com
Sat Jul 18 13:32:53 UTC 2009


On Tue, Feb 28, 2006 at 11:29:58PM +0100, Joerg Hoh wrote:
> Hi
> 
> We need to have a persistent statefile if we want to avoid to reuse a uid
> which was already used by some other user. Think of the following scenario:
> 
> adduser foo
> -> foo gets uid X
> 
> deluser foo
> -> uid X is no longer used
> 
> adduser bar
> -> bar gets uid X
> 
> So this uid is reused, even with the "always increment the hightest
> already used uid by one and assign it to the new user"-algorithm.
> 
> 
> But the whole thing of making this value persistent seems rather ugly to
> me. Need to think some time about that, maybe I have a better idea to solve
> that issue (a file for a single value).

Well, we already have this "state file" in the system, namely
"/etc/passwd". We could create a disabled system user with a system UID
(for example UID 999, and for example named "adduser"), which would be
managed by the adduser scripts, and which would hold in the GECOS field
the highest ever used user ID in the system.

So, every time a new user is added to the system, the adduser scripts
would update the GECOS field of this "adduser" system user.

This "adduser" user could be disabled ("passwd -l adduser") as it is
never meant to login into the system.

This solution keeps compatibility with the old scheme of things, and
needs no special state file, while solves the problem.

What do you think?

-- 
Pepe
pepe at naleco.com






More information about the Adduser-devel mailing list