passwd and LDAP uid confusion

I have an LDAP server with usernames and UIDs that started at 9000.

On a shared server, if I use pw to add a new user, pw does a lookup against the LDAP server and sets the new user to id of 9018, or whatever.

Obviously, if I then use the next uid on the LDAP server and add a user with uid of 9018, there will be confusion on the server I ran 'pw' on.

Did not see anything about LDAP in the pw man page. Only way of blocking pw from looking up LDAP is to change /etc/nswitch.com while I run it, but I'd want a better solution. Anyone have an idea?
 
Why not check for last UID assigned locally and then specify that number plus one to pw(8) with the -u flag?

here is a free one-liner to find the next available local UID:

Code:
awk -F: '{ print $3 }' < /etc/passwd | sort -un | sed '/^65534$/d' | tail -1 | xargs expr 1 +
 
Back
Top