In OS X, the creation of separate user accounts is useful not only for keeping work and private documents separate, but also so users can have their own settings and system customizations that will not interfere with those of other users. User accounts can be added or removed in the Accounts System Preferences (called Users and Groups in Lion), but in some situations, people are finding that they cannot remove some accounts from their systems, and when they try the accounts will show up the next time they open Accounts.
Account access and management problems may happen when you perform modifications to your system, which include upgrades and updates, or migration from another system. The system may try to merge the accounts directory and if there are conflicts such as duplicate user IDs being used, then the system may change these to accommodate the accounts; however, any errors in this process may result in the account no longer being accessible or manageable by various tools, including the System Preferences.
If a specific account cannot be deleted or modified through the System Preferences, then removing it using the Terminal and setting it up again (if desired) should work to restore functionality.
Removing the account
System accounts are basically set up in two parts. The first is the directory entry where account attributes (identification numbers, group associations, and name aliases) are stored. The second part are the user's resources on disk, which by default are the user's home directory, but can expand to directories in other locations and in secondary volumes attached to the system. Access to these resources is governed by their association to various directory accounts through user and group identification numbers, in addition to permissions that are associated with those numbers.
When removing an account, the first step is to remove the account entry from the system directory, which can be done with the following steps:
Get the username of the account you wish to remove
Unless you have modified some relatively hidden account settings, the user's home folder will be the same name as its username, so you can find the account username by going to the /Macintosh HD/Users/ folder in the Finder. In here, locate the folder of the account you wish to delete, and make note of its name.
Use the Terminal to confirm username
Through the Terminal you can use the utility "dscl" (directory services command line utility) to make modifications to the system directory, including deleting accounts. With this utility, first confirm that the directory contains the entry for your located account username, by running the following in the Terminal:
sudo dscl . list /Users
With this command entered, the utility will ask you for your password (it will not show when you type it), and then will output a list of all the users on the system. You will see a number of them with underscores before their names; ignore these, as they are system accounts for running various services. At the end of the list you will see the local usernames listed, so confirm that the home folder name you noted earlier is present before moving to the next step.
Delete the account
With the account name confirmed, now you can remove the account directory entry from your system by running the following command in the Terminal:
sudo dscl . delete /Users/ACCOUNT
In this command, replace the word "ACCOUNT" with the account name you found and confirmed in Step 2.
Managing resources from deleted accounts
After the account is removed, the user's home folder will still be on the disk in the /Macintosh HD/Users directory. At this point you can simply delete the directory to fully remove all items that were associated with the removed account. Alternatively, if you would like to try saving the account, you can use the directory as the home folder for a newly set up account. Doing this will refresh the account on the system, which may fix the account if errors were just in the directory entry for it and not in the account's home folder itself.
To re-create the account and use the existing home folder, leave the folder on disk instead of deleting it, and then go to the Accounts System Preferences and create a new account. Use the same short name as the previously deleted account (it should be the same name as the home folder), and when you do this the system will detect that a folder with this name exists on the system. It will ask you if you would like to use the existing home folder, and if you do so then all the previous account setting and data will be associated with the new account.