Solved Unable to modify a user's uid (pw question)

Hello everyone,

I try to change the uid of a user to 2009 instead of 1009, in this way:
Code:
# pw usermod test_user -uid 2009
But as a result I get:
Code:
# cat /etc/passwd | grep test_user
test_user:*:1009:1009:User &:/home/test_user:/usr/sbin/nologin
#
I read the pw() but can't figure out what's wrong. pw usermod does not produce an error, but does not do anything at all.

What am I doing wrong? Can anything prevent from changing users' uids?

PS here's the adduser that created my test_user:
Code:
Username: test_user
Full name:
Uid [1009]:
Login group [test_user]:
Login group is test_user. Invite test_user into other groups? []:
Login class [default]:
Shell (sh csh tcsh bash rbash nologin nologin) [sh]: nologin
Home directory [/home/test_user]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [no]: no
Lock out the account after creation? [no]: no
Username  : test_user
Password  : <disabled>
Full Name  :
Uid  : 1009
Class  :
Groups  : test_user
Home  : /home/test_user
Home Mode  :
Shell  : /usr/sbin/nologin
Locked  : no
OK? (yes/no): yes
adduser: INFO: Successfully added (test_user) to the user database.
Add another user? (yes/no): no
Goodbye!
 
I must add that:
Code:
# pw usermod test_user -n test_user -uid 2009
ends up with the same result.

Same problem on FreeBSD 9.1-RELEASE and FreeBSD 10.0-RELEASE-p2.
 
What's the output of:
# id test_user

Just wondering if the /etc/master.passwd database is getting updated correctly, but the compat file /etc/passwd isn't getting regenerated.
 
Seems to be the same:
Code:
# id test_user
uid=1009(test_user) gid=1009(test_user) groups=1009(test_user)
 
I think that after having changed the uid, ls should show numbers (the old uid) instead of test_user as owner:
Code:
# ls -alhG /home/test_user/
total 40
drwxr-xr-x  2 test_user  test_user  512B Jan  7 18:17 .
drwxr-xr-x  12 root  wheel  1.0K Jan  7 18:17 ..
-rw-r--r--  1 test_user  test_user  971B Jan  7 18:17 .cshrc
-rw-r--r--  1 test_user  test_user  255B Jan  7 18:17 .login
-rw-r--r--  1 test_user  test_user  166B Jan  7 18:17 .login_conf
-rw-------  1 test_user  test_user  382B Jan  7 18:17 .mail_aliases
-rw-r--r--  1 test_user  test_user  339B Jan  7 18:17 .mailrc
-rw-r--r--  1 test_user  test_user  751B Jan  7 18:17 .profile
-rw-------  1 test_user  test_user  284B Jan  7 18:17 .rhosts
-rw-r--r--  1 test_user  test_user  981B Jan  7 18:17 .shrc

Something else:
Code:
# tail -n 1 /etc/master.passwd
test_user:*:1009:1009::0:0:User &:/home/test_user:/usr/sbin/nologin
 
Oh I can't believe I've spent hours on such a stupid mistake...
Many thanks!

PS. I was sure I had read this -uid somewhere, that was here: find()
 
That's a bit strange. As I mentioned, I get no error using
Code:
pw usermod test_user -uid 2009
on both FreeBSD 9.1-RELEASE and FreeBSD 10.0-RELEASE-p2.

Though, if I try:
Code:
# pw groupmod ftp_users -gid 1100
pw: entry inconsistent
pw: gr_copy(): Invalid argument
 
Back
Top