Accidentally created user with duplicate UID. How to fix?

I can see two options:

  1. Delete the jenkins user, create it again (with a unique UID this time), then repeat all the commands you used to create its files. This is probably the best option if you haven't created any extra data or customization since the jenkins was created. Be careful when deleting the jenkins user to make sure you don't delete original-user.

  2. More kludgy: change the UID of one of the users by manually editing /etc/passwd, then use chown -R to change the ownership of that user's files appropriately. This is kludgy and might work but also might not work.

I'd go with option #1, personally.


On Mac OS X, you can change a UID of a local user using System Preferences > Users & Groups.

Open the padlock there to allow changes to be made and then right-click on the user you like to change.

NOTE: You should not be logged in to that account at the time you do the change.

Also, POSIX permissions will follow the UID, so after changing it you may need to change the user ownership for that home folder or you would face not to be able to log in to the changed account.

Command for changing ownership would be:

sudo chown -R <account_name> /path/to/userhomefolder