[Date Prev][Date Next]
Antw: Re: create new user with same UID and GID
>>> Michael Ströder<email@example.com> schrieb am 21.02.2015 um 20:06 in
> Bernd May wrote:
>> You could also create a dummy user account that stores the next usable
>> gid/uid pair (which you acquired once with the previous algorithm) and
>> then query that account each time you create a new user, increase its
>> gid and uid values and create your new user. This assumes some kind of
>> conflict free numbering scheme of your users by which you can infer the
>> next free number pair automatically.
> The problem with id pool entries (kind of a sequence generator) is that ids
> might be consumed without being really used. Therefore for numeric ids it's
> better approach to search for all entries, use reverse server-side sorting
> only query one result to get the highest id.
But that's somewhat "performance-heavy" I guess. What could help here would be
transactions (actually nested transactions). Consume a UID/GID and assign it to
a new entry in one transaction.