View Full Version : changing uid and gid numbers for users in os x

05-24-2003, 09:50 PM
newbie warning, day 5 with os x now!
I posted a previous question here about connecting to a linux server from an os x client using nfs, and got an answer that was spot on. User richard (me) has uid/gid 500 on the linux (RH8) server and uid/gid 501 on the os x client. I tried changing my uid in the utilities/netinfo manager application, which of course did not work. I tried logging in as superuser, but I don't know its password. So 2 new questions: how do I change uid/gid for users in os x; and how do I log onto the os x system as root (superuser)?

05-24-2003, 10:02 PM
For both questions:
Netinfo Manager, in /Applications/Utilities

There is a menu option to enable the root user, which is actually disabled for safety at installation. You shouldn't really need to do this, but it can make some things easier. sudo and Pseudo (launches any app as root) can do pretty much everything you need to do.

To change uid/gid, navigate through the hierarchy to /users and /groups, and you can click on each user or group and change its properties in the bottom part of the window.

Be careful with a uid of less than 501; I believe X has a threshold (501 or 500 or something) under which users are not displayed in the GUI login panel.

05-24-2003, 10:31 PM
After you change the UID, you will also need to change the ownership of every file on your disk to be owned by the "new you." Changing the UID value in Netinfo Manager only changes the numerical value associated with your short username.

Here's a pointer to a hint on the main site that talks about fixing all of your files:


05-24-2003, 11:09 PM
changing a user uid is not a trivial operation. one must also gather all files that belonged to the old uid and reassign them to either the new uid or some other appropriate ownership. right?

[edit: right. what houchin said]

05-25-2003, 05:30 AM
thanks guys,
as one of you noted, changing uids on the iBook was not trivial, it was much much simpler to change the uids on the linux server using Webmin (is there a version for os x?). NFS works a treat with the same uids. Still got a bit of work to do to get the network humming, (setting up automounts, making the serverf home drives the defaults, getting the samba printing working etc) but its happening.

05-25-2003, 06:24 AM
Webmin works fine on OS X.

Changing UIDs in the terminal is a simple NetInfo property overwrite:
sudo niutil -createprop . /users/userName uid XXX
(replace userName as appropriate and XXX with the new UID number)

Finding and changing UIDs across the filesystem is a one-liner command:
sudo find / -user UID -exec chown userName {} \;
(replace UID with the old UID number and userName with the new user name to associate file ownership.)