[X Servers] Changing user ID number recursively [XPOST]

James Bucanek subscriber at gloaming.com
Thu Jan 16 16:59:03 PST 2003


Steve St-Laurent wrote on Thursday, January 16, 2003:
>After months of flailing I've realized that my woes with OS X 10.2 
>server arose from having my user ID [administrator] in the 500s. 
>Changing this number to more than 1000 seems to have resolved all my 
>permissions on stuff shared with other users.

I don't know what your situation is exactly, but I suspect that it's not the range of your user IDs that's the problem.  I suspect that it is the fact that your IDs overlap those IDs of other users on other systems since all user IDs are typically allocated starting at 500.

I'd look into ignoring ownership on external volumes before you went to the trouble of pointlessly renumbering all of your user IDs.

>I want to recursively change the ID number throughout the server 
>volumes to clear up a few access inconsistencies. Currently running 
>10.2.3.
>
>1. Is this safe? Will a UID >1000 mess up my privileges as an 
>administrator?

I don't see why it would.  An ID is an ID is an ID.  Ranges of IDs are mearly conventions, the system doesn't inforce ranges of IDs anywhere that I know of (except for obivous limits like trying to use ID 0).

<Insert space for some old UNIX salt to point out the three obscure exceptions to that statement.>

>2. If the answers above are YES and NO, in that order, what's the 
>terminal command to do this? I'm guessing something like "chuid 
>username 1050 -r". I know very little command-line stuff, so don't 
>laugh.  :~]

Oops, now you're in trouble!

I'm not aware of any single command to change a user's ID.  This is just not normally done.  What you have to do is change the user's assigned ID in the NetInfo database (which can be scripted with niutil command), then you'll have to change the ownership of every directory and file on every volume that belongs to said user from the old ID to the new ID.

I've had to do this on a couple of systems.  I usually use a 'find' command to generate a list of every file owned by a particular user ID (numeric of course since, you've changed the user's ID already) then pipe that to xargs & chown to change the ownership of each file to the new user's ID.

Something like:

    find / -owner 501 -print0 | xargs -0 chown 901

And you'll have to execute all that as root (I usually just start a root shell with sudo -s).

If you didn't follow any of that, you might want to wait for a better suggestion.  ;)

______________________________________________________
James Bucanek       <mailto:privatereply at gloaming.com>



More information about the X-Servers mailing list