[CentOS] Determine next UID number

Wed Oct 13 20:57:09 UTC 2010
Bowie Bailey <Bowie_Bailey at BUC.com>

 On 10/13/2010 4:42 PM, Rudi Ahlers wrote:
> On Wed, Oct 13, 2010 at 10:40 PM, Bowie Bailey <Bowie_Bailey at buc.com> wrote:
>>  On 10/13/2010 4:22 PM, Terry Polzin wrote:
>>>
>>> LASTUID=`cat /etc/passwd |grep -v nologin|cut -d ":" -f 3 |sort -n |
>>> tail -1`; NEXTUID=`expr $LASTUID + 1`; echo $NEXTUID
>> That assumes the highest UID number has a login shell...
>>
>>
>
> which is generally the case...

Not on at least two of my systems.

The best solution would be to pull the UID generation code from the
useradd program to create something that will simply spit out the next
UID using the same algorithm.

-- 
Bowie