Posted on 12-29-2017 09:13 AM
I'm trying to change the short name of an account via the CLI. Right now I'm unsure of how to target the "Account name" property. However, I've been able to change the Full Name with the following command.
sudo dscl . change /Users/<myShortName> RealName "Sean Boult" "seanboult"
Am I able to change the "Account name" property from the command line?
Posted on 12-29-2017 09:41 AM
Nm you already tried what I was going to suggest. You try anything with sysadmctl?
Posted on 12-29-2017 10:48 AM
@Nix4Life I have not tried to mess with sysadminctl. After taking a look at the man page it appears it does not have the ability to change the account name. I could be wrong though.
Posted on 12-29-2017 12:41 PM
I believe the property is known as "RecordName" So if you do something like the following:
dscl . read /Users/<myShortName> RecordName
it should print back the short username, as in RecordName: <myShortName>
I haven't tried it myself, but I think if you do something like:
dscl . change /Users/<myShortName> RecordName <myShortName> <myNewShortName>
it may change that in the record. You will of course have to change the home folder name and make sure the permissions on the home folder reflect the new name, yada yada yada. It's almost a given that something might get missed in the transition and cause some issues, so I would do extensive testing on a non-logged in account and see what happens when you log back into it.
Posted on 04-22-2020 10:35 AM
Just saw this - would there be a way to combine (Full Name, Account Name, and Home Folder) into a script like: https://community.spiceworks.com/scripts/show/4409-mac-account-rename-script-username-home-directory-display-name
but to prompt the user instead to enter their new information themselves, sort of like this post you were active in @mm2270 https://www.jamf.com/jamf-nation/discussions/11440/rename-user-account