Wednesday, October 29, 2008

Changing short names in OS X (very difficult)

his article talks about how to change the user's short name in OS X. The section that most interests us is the descriptions of the best way to copy the old user's Home directory contents into that of a new user.

The full Mac tech article is here:

http://docs.info.apple.com/article.html?artnum=106824

The relevant bits for us are:


Though there are methods by which an advanced user may change the short name and related information, the easier and safer workaround is to create a new user with the desired name, then copy the old user's Home directory contents into that of the new user. Follow these steps:

1. Optional step: As a precaution, you may disable automatic login prior to performing this procedure. You might want to back up important data, too. In the event that you restart the computer for any reason before completing the procedure, this would prevent complications from having displaced the user selected for automatic login. For Mac OS X 10.1.5 or earlier, automatic login is found in the Login preference pane. For Mac OS X 10.2 and 10.3, it is found in the Accounts preference pane.
2. Mac OS X 10.3 or later: If FileVault is on, temporarily turn it off, which will log you out.
3. Enable the root user, then log in as root. For further explanation of this step, see "Mac OS X: About the root User and How to Enable It".
4. For Mac OS X 10.2 or later: Open the Accounts pane of the System Preferences application.
For Mac OS X 10.1.5 or earlier: Open the Users pane of System Preferences.
5. In the Name list, locate the user with the short name that you want to replace. This will be referred to as the "original user".
6. Note whether or not the original user is identified as Admin, which appears in the Kind column to the right.
7. Click New User. For 10.3, this is the plus (+) button.
8. Complete the Name and Short Name fields as desired. Be sure that the Short Name is exactly as you want it to appear.
9. For Mac OS X 10.2: Fill in the New Password and Verify fields.
For Mac OS X 10.1.5. or earlier: Click the password tab, then fill in the Password and Verify fields.
10. If the user you are replacing is an Admin user, then select the checkbox for "Allow user to administer this computer". For 10.3, click the Security tab to locate this setting.

Note: This checkbox is dimmed and already selected if there is not another Admin user. Mac OS X requires at least one Admin user.

11. Click Save. (Skip this step for 10.3.)
12. Quit System Preferences.
13. Click the Finder icon in the Dock.
14. Choose Computer from the Go menu.
15. Open the Users folder in the Mac OS X disk.
16. Open the folder with the short name of the new user that you just created.
17. Drag the contents of this folder to the Trash.

Warning: Do not empty the Trash yet. In the event that you accidentally move contents of the wrong folder, you may recover them from the Trash after discovering your mistake.

18. Choose New Finder Window from the File menu. Be sure to position the new window so that you can see both Finder windows.
19. In the new window, open the folder of the original user.
20. Press the Option key as you drag the contents of the original user's folder into the new user's folder (that you emptied in Step 16). This makes a copy of the contents.
21. Close one of the Finder windows.
22. Open the Terminal application (located at /Applications/Utilities/).
23. Type: chown -R /Users/

Important: Replace "" with the actual short name of the new user you just created. For example, if the new user had the short name "jacques", you would type:

chown -R jacques /Users/jacques

24. Press Return
25. Quit Terminal.
26. Choose Log Out from the Apple menu.
27. Log in as the new user. You should be able to access all of your original files on the desktop and in the folders of the Home directory.

Important: If you do not have access to your original items, log out and log back in as root, then repeat Step 22. Also, be sure that you did not place the wrong files in the Trash in Step 16.

28. Choose Home from the Go menu.
29. Open the Library folder, then the Keychains folder inside it.
30. Select the keychain, which should still have the short name of the original user.
31. Choose Show Info from the File menu.
32. In the Info window that appears, choose Name & Extension from the pop-up menu.
33. Change the name to match the new user's short name.
34. Close the Info window.
35. Open the Keychain Access application, located in the Utilities folder.
36. From the Edit menu, choose " Settings". For the user Jacques, this would appear as: jacques Settings
37. Click Change Passphrase.
38. Enter the desired password, then click OK. You may use the same password again or set it to match the login password of the new user.
Note: This step prevents you from discovering later that the keychain had retained an older password.
39. Quit Keychain Access.
40. Disable the root user, as explained in Section III of technical document 106290, "Mac OS X: About the root User and How to Enable It".


Notes

1. If everything is working correctly, you do not need to log back in as root to empty the Trash. The folders you put there occupy a negligible amount of disk space.

2. Depending on what software you have installed, you may wish to rename other files and folders that may have been created under the original user short name to match the new user short name.

3. Once you are certain that everything is working properly, you may want to delete the Home directory (folder) of the original user, which should be empty. For instructions on how to do this, see technical document 106256, "Mac OS X: Deleting a Former User's Home Directory (Folder)".

No comments: