In Mac OS X, a users short name is what their home folder is named after and it’s also the shorthand name for logging into the Mac either from a lock screen or a network connection with remote access through SSH and SFTP. There’s various reasons that you’d want to change the user short name, but it’s not just a matter of changing the name listed on a user account. We’ll cover four different ways to do this, a simple way that just changes the short user name for login purposes, and three more complete methods that will change not only the short user name but also the users directory name to match. Go with what is appropriate for your skill level.
It’s important to note here that spelling matters, as does capitalization, any differences in spelling or capitalization and things will not work. Do not attempt to use a short user name or account name that has spaces or special characters, keep it simple with normal characters.
Before proceeding, make sure you have a recent backup of your Mac and it’s important data. If you haven’t backed up in a while, you can force a manual backup in Time Machine easily. Once you’re backed up, read on.
Change the User Short Name Only
This is how you just change the actual short name of a user, for purposes of logging in to the Mac. This will not affect the name of the user account home directory:
- Open System Preferences and click on the “Accounts” pane
- Click on the lock icon in the lower left corner and enter your administrator credentials
- Right-Click on the user whose short username you want to change and click on “Advanced Options”
- From the “Advanced Options” screen, edit the user name as listed next to “Account name” as seen in the screenshot below
Remember, the above instructions only change the users short account name and not the name of the users home directory. This brings us to a few different ways that we can change both the user account and the directory name:
Changing User Short Names & Home Directory Names: The Apple Way
This is the method that Apple recommends on their knowledge base, this method may seem lengthy but it automatically handles the permissions and file ownership changes, making it easier for some users.
- First, you’ll need to enable the root user in Mac OS X if you haven’t done so already
- Log out of your existing user account and log in to the enabled root user account
- Open /Users/ and you will see the user account home directory, rename the user accounts home directory that you want to change the same way you would rename any folder or file in Mac OS X. Apple cautions that the user short name can not contain spaces or special characters
- Now open System Preferences and click on the “Accounts” panel
- Create a new user account with the same short name that you used to rename the users home directory
- You will see a dialog warning “A folder in the Users folder already has the name “username you chose.” Would you like to use that folder as the Home folder for this user account?” – click OK
- Now log out of the root user and log in to the newly created user with the short name you chose
- Verify that all files, folders, permissions, ownership, and everything else is as expected. Navigate around, open a few files, etc. If things look good, you can now go back to the Accounts preference pane and delete the original user account
For security purposes, Apple recommends disabling the root user account, but you can determine whether or not that is necessary based on how often you need to use root access.
Advanced Approach: Changing the User Short Name & User Directory Name via Admin or root & chown
You can also use a more advanced approach which may be preferred by some, although for most users I would suggest Apple’s way. Proceeding along, if you wanted to change the users directory name as well as the short name, another way to do this is by using a separate Administrator account (or even root from the command line) to rename the users home directory (preferably to the new short name). You could do this from the Finder with an Admin account, or using sudo and root from the command line:
sudo mv /Users/oldname /Users/newshortname
Then, through the same process of accessing the “Advanced Options” of the Account panel as mentioned above, you will select the newly renamed home directory as the users default by clicking on the “Choose” button and then navigating to it. If you chose to do this through the command line, this is more of a confirmation step.
After the directory name change has been made, you will likely need to adjust the file ownership and permissions using chown to the new username:
chown -R newshortname /Users/newshortname
As with the other methods, you’ll want to confirm that everything is working by logging into the newly renamed account and opening and accessing files.
On another note, you can also use this option to change the location of a users home directory. For example, if you have a small SSD drive for the operating system and applications to launch quickly off of but you want to keep all your files on a separate drive, but that’s branching onto a new topic.
Advanced: Changing Short User Names with sudo, mv, and Spotlight
Yet another method to change the short user name exists and it’s quite a bit more advanced.
Before beginning: Have a backup of your entire Mac done, this is editing user files and making changes to how the OS observes that user. If you don’t have a compelling reason to do this, or you aren’t comfortable with modifying system files and using the terminal, do not proceed. Also, you will probably want to enable Fast User Switching to be able to do this quickly. Done properly, you will have the short user name changed in just a few minutes, but this is not a traditionally supported method so proceed at your own risk!
This has been verified to work in OS X Mountain Lion. Always make a backup before modifying important files.
- Log on to another Administrator account (create a new account with admin privileges if necessary)
- Open Terminal from /Applications/Utilities/ and type the following commands:
- Locate the old user name directory, make note of the exact spelling and capitalization, our example will use “OldShortName”, then use the next command replacing that username as necessary, and indicating the new short user name as desired
- Enter the Admin password when requested, this is required for using sudo
- Now pull down the Apple menu and select System Preferences
- Choose “Users & Groups” and select the user name you are changing
- Right-click on the user name you wish to change and choose “Advanced Options…”
- Change the fields next to “Account Name” and “Home directory” to accommodate the new short name
- Click “OK” to accept the changes, there may be a slight delay as things are updated
sudo ls /Users/
sudo mv /Users/OldShortName /Users/NewShortName
The short user name is now changed, but you’re not quite done yet. Log out of the currently active Administrator account, or use Fast User Switching to summon the Login window and then log in as the newly renamed user.
This next set of steps is just as important, otherwise Spotlight and Smart Folders will not work:
- Log in as the renamed user
- Confirm the user files are where they are expected to be, in ~/Documents, ~/Desktop/ etc, open a few to verify that permissions are functioning as they should be
- Now launch System Preferences from the Apple menu and choose “Spotlight”, then click the “Privacy” tab
- From the Finder, navigate to the /Home/ directory, select the newly renamed users directory, and drag and drop it into the Spotlight Privacy window
- Now select the Users directory from the Spotlight Privacy window and delete it, this forcibly rebuilds the Spotlight index for this users files, allowing all files to be found as expected with Spotlight, Smart folders, and All My Files
- Close out of System Preferences and wait for Spotlight to rebuild
- When finished, open “All My Files” to see a list, and verify that Spotlight is now working by searching for a file with Command+Spacebar
If you did everything correctly, the users account short name will now be changed. If you wish to, you can now remove the extra administrator account
Updated: 1/25/2013
“Cutting-Edge Deals, Everyday Prices: Tech Up, Spend Down!”