Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.5: Move a user's home directory via the command line' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Move a user's home directory via the command line
Authored by: ddelo on Nov 07, '07 03:36:30PM

Since Leopard removes the NetInfo Manager utility, you can no longer use it to change your UID for the user account. Tiger also had command line utilities to modify the NetInfo database, but those have been removed as well.

In Leopard, you can use System Preferences or the dscl command line utility to modify the local user database.

To use dscl:

dscl . -read /Users/USERSHORTNAME

This will print out all the values for your user. Look for the UniqueID key and its value - this is what we are going to change.

To change the UID:
dscl . -change /Users/USERSHORTNAME UniqueID OLDUID NEWUID

Leopard's System Preferences also has a much easier to do this. Open the Accounts System Preferences and click the lock and authenticate. Then, for the user you want to change, RIGHT-click on the "Admin" or "User" text below the user's name. A contextual menu "Advanced Options" should appear - click on that. A sheet will appear with information about your user. You can change the UID from this pane. You can also change your shell, group ID and other user information from here.

Once you have done this, your files will still be associated with the old UID.

Run:
sudo find -x / -user OLDUID -exec chown NEWUID {} ;

to get your files back.



[ Reply to This | # ]
10.5: Move a user's home directory via the command line
Authored by: dgm on Sep 17, '08 05:14:59PM

Does 10.5.5 break this hint? i've been using this hint since Leopard came out without problems. after installing the 10.5.5 patch though my moved home directory was not used. instead the default of /Users was used. i've tried to reset the moved home directory in dscl as described above but now get an error that the dsAttrTypeNative cannot be found. a cat of my user info does not show the information although the NFShomedirectory is set to the proper directory.

i've googled the problem but have found nothing apropos. i've checked the apple support site and found nothing there.

i did check the dscl and the DirectoryServiceAtrributes man pages. i did not see the attribute listed or mentioned. i did see dsAttrTypeStandard:HomeDirectory and tried it but again the attribute not found error.

help please. i've been unable to get to my home account normally for the last day.

thanks



[ Reply to This | # ]
FIND command clarification
Authored by: Alper on Mar 17, '10 07:41:54AM
Thanks so much for this System Preference heads up. Exactly what I needed for a distinctly different problem. Two things that users should be aware of: 1. In certain situations the ";" portion of the find command needs to be "escaped" in order for it to be visible to the command. You'll recognize the situation because find will complain that there's "no terminating ';' or '+'." I'm this case you need to enclose the ";" in single quotes, as in:
sudo find -x / -user OLDUID -exec chown NEWUID {} ';'
2. Depending on the number of files associated with the old UID, this command can take a very long time (way longer than a permissions repair, for example).

[ Reply to This | # ]