Fix for losing administrator access to your account after changing user account name in Mac OS High Sierra 10.13

Note: modifying your user account in Users and Group in Apple System Preferences are for advanced users only. It is NOT recommended for normal users.

If you tried to modify your user account name under Users & Group in Mac OS High Sierra 10.13 may cause loss of administrative privileges with your user account and you will not be able to authenticate your computer as administrator anymore:

The below is a fix for the above problem and is only recommended for advanced users only. Before attempting the fix, make sure to back up your data first.

Follow these steps:

Shut down your Mac
Power up your Mac and immediately press and hold the command + S keys
Keep the keys down until you see text on the screen
Now enter the following command:

/sbin/fsck -fy

and press enter

Next enter the following command:

/sbin/mount -uw /

and press enter

Now enter the following command:

rm /var/db/.AppleSetupDone

and press enter

Finally, enter the reboot command

and press enter

Your Mac should reboot and you can log in normally, after which point the Setup Assistant will launch. Now you need to create a new admin user. Don’t worry, your other user accounts should be intact. NOTE: You should choose a new user name for this admin account.

Once you’re back up and running you can go to Apple > System Preferences > Users & Groups and select the Allow user to administer this computer checkbox for the ‘grant’ user.

Final words:

Modifying your user account is for advanced users only, do not attempt to do so unless you are experienced with Apple Mac.

To have the user name under your preferred name, create a new user account instead and let Mac OS take care of the setup for you.