Mac terminal change user id

This dialog also shows you your primary group. Run id in Terminal for more verbose output. This will include your numeric user ID. It'll also list all groups you're a member of, not just your primary group. The first group is the primary one. Use the id command from the terminal. It will display your uid and the groups you belong to. For example, here is my output showing my user id , group id 20 and the groups I belong to also To answer this specific question if I was writing a script that would work in any environment, I wouldn't assume that the default group staff is in use and instead I would do the following if I was writing a script that could be run for any user whether or not they modified their system :.

It's always better to be platform agnostic whenever possible if it's not too much of a time tradeoff , as you will incur less technical debt later. Please note that chown 's -R flag should be used with the utmost confidence. You could really mess up your system Although it is worth noting that Apple made it hard to do since they implemented System Integrity Protection.


  • unix - How do you change your UID in OS X Mountain Lion - Ask Different.
  • Hint Options.
  • Related Articles;
  • logitech control centre mac uninstall.
  • mac os audio editor free.
  • Then rename the account.
  • Categories;

I can't tell you what would break first, but it would break first on a Darwin system, but please take my word that it wouldn't be pretty. Home Questions Tags Users Unanswered. Ask Question. Trying to run this compand in terminal: sudo chown -R yourid:yourgroup local However, I have no idea what my ID and my group are, or where to find them. Any ideas? Starkers Starkers 4 4 gold badges 19 19 silver badges 30 30 bronze badges. Instead of using whoami , you can use id in a oneliner that is compatible with posix shells and csh.

If you use LDAP authentication your username won't necessarily be staff. Not on my work Mac OS X anyway. Sridhar-Sarnobat I address this in the second half of the first sentence of my answer. Scott 17k 11 11 gold badges 44 44 silver badges 91 91 bronze badges. This will show your userid. The group names are inside parentheses. Gabriel Wu Gabriel Wu 2 2 silver badges 3 3 bronze badges.

How to Add a User From Terminal Mac OS X Screen Sharing

It should look like this: drwxr-xr-x 2 username usergroup Oct 17 Templates. That seemed to work. In the case of launchd. A useful guide - thanks! Personally, as an old Linux guy I prefer working as root. But for this guide I think it's best to use the root user over the sudo approach because using sudo implies that you work as a different non-privileged user what may but doesn't necessarily have to be the case.

Using the root user, you don't run into the mentioned problems entering folders that you don't have access to. In the end, using sudo or the root user is mostly just a matter of preference. It turned out that there were too many files and folders which carried in their names without being related to the uid anyhow but only a few to none I don't remember relevant ones that should have been renamed.

So I did it exactly as you suggest.


  • mac miller ft drake mp3 download!
  • modernist cuisine mac n cheese recipe.
  • mac os x text editor line numbers;
  • director 11.5 mac serial number.
  • windows 7 mac free download.
  • uconn mac and cheese buzzfeed.

I've updated the how-to accordingly. Thanks for your hint, Tim! Great discussion guys. I didn't mention it earlier, but I used sudo for this entire process as well.

No Admin Account Fix Mac / Change Other User Passwords With New Account -Mac OS-

Also, with sudo, there's no chance I'll forget to disable root when I'm done. I think Roman's exactly correct. It's usually a matter of personal preference. Anonymous says: Feb 03, AM. Yet another sudo discussion? But sometimes I tend to use the root account, especially when I have to use lots of admin commands - or write some how-to that should be easy to use. Another option, of course, is to use "sudo -s" or "sudo -i". This will turn your shell into a "root shell" so you don't need to enable the root user or hack in "sudo" again and again which can be quite annoying.

Anonymous says: May 04, AM. What modifications are needed for I have tested the above info in Snow, however I have a few users in I'm sorry but I can't test that because I don't have a machine running Tiger any more. Anonymous says: Sep 02, PM. Excellent article, thanks! I just used this on Just wanted to say thanks! The procedure worked just as described. The only thing I'd add is to reboot after all the chown-ing and mv-ing is done. I logged into one of the affected accounts immediately after moving everything around and everything was wonky no Desktop, no Finder, etc.

I'm guessing some processes got confused by the changed UIDs and needed a fresh start. Thanks for this, very handy. One thing to add is the chown call should be chown -h or if you have any symlinks then they end up beloning to the old userid. I also changed the gid PrimaryGroupID to match and did the same thing for the chgrp call. Anonymous says: Oct 31, AM. For some reason, chown wasn't in my path and couldn't find it since the locatedb wasn't properly loaded.

Took me a while to find it but wanted to make sure others could find it easily. Adding it to delicious now! Anonymous says: Nov 03, PM. Hi all, Anyone can help me with this? Anonymous says: Nov 18, AM. This one might be a little more complete. Also changes owner of symbolic links. Also uses xargs to execute the chown command as few times as possible. Note I just did this on Lion. Roman says: May 23, PM. Finally, I've updated the guide according to your hint. Thank you! Anonymous says: Jan 04, PM.

Quick Links

It's very important to use "chown -h" instead of "chown". The link target may have a completely different uid. Right, I've changed the commands. Anonymous says: Jan 21, PM. After a restart it also changed automatically the ownership of the user's files? Or would this only change the user-id and nothing more?

Thanks for any hints …. I doubt that this will work, but I haven't checked. Feel free to try and report back :. Anonymous says: Feb 11, AM. No, it's not sufficient. Anonymous says: Oct 03, AM. No problems here, but of course you should have an clone or a backup of your system and user stuff. This is a great manual! Since I wanted to have my System and Accounts on the SSD, but the working files "data" on the old drive, this was a real pain. I didn't want to get rid of all user stuff on the old drive either, to have a fallback in case there were issues with the new SSD.

At least for the main issues I'm now really happy. Anonymous says: Apr 06, PM. I have done this on SL, but now find that the user wont show up in the login window. I can manually type in my user name in the login window and that works. Anyone have an idea why this is? Alexey says: Aug 29, PM. There is no such problem with UID Anonymous says: May 24, AM. Changing to the root user worked up until I got to the Directory Utility. Please advise. Anonymous says: Jun 19, AM. No problem at all - just use the sudo method In Terminal, type 'sudo -s' once, then begin with the rest of the guide.

Be sure to use a different user account - not the one you want to change.

Your Answer

You explained exactly what I was looking for. Works great under Lion. Anonymous says: May 30, PM. Thank you all for your useful comments! I've updated the guide accordingly. I'm glad if this how-to is helpful. Anonymous says: Sep 01, AM. This is a great walk through and has worked flawlessly a few times now. I was wondering if you think this would easily be implemented in a script with prompts to enter text username, mainly. I'll be working on it regardless, but my skills aren't that fantastic. Anonymous says: Sep 01, PM. Glad to hear! Sure, writing a script for this shouldn't be much of a problem.

But I'm currently extremely busy, so I'm afraid I can't help you with that atm. Anonymous says: Aug 23, PM. First of all this article is great! Everything worked flawless for me. I am also interested in changing the default GID for a user account.

A script to help change file user ID's - Mac OS X Hints

Can this same process be applied to change the GID? I haven't found a list of 'keys' that would apply here, but I haven't looked that far into Google either. I just thought I would start here since this is already a great article! Thanks in advance for your help! Glad to hear, thanks! Just have a look at the output of "dscl. Anonymous says: Nov 12, AM. I'm trying to chown as root on Mac OS I thought root could do everything? Any ideas? One thing that puzzles me is how MacOS can have multiple owners and groups in the Info window Anonymous says: Dec 03, PM.

Hi - many thanks for this, very useful. Bob says: Sep 20, AM. I think the "chown -h Same goes for Jamie too I think. Hi there, just thank all you, this worked great! Had reinstalled my macbook and forgot to create a first user to match ID with my remote timeMachine backup. I followed the process and changed UID successfully and all worked again, also backup to my old backup-copy. Anonymous says: Jan 12, PM. After following this good guide I am missing the user in the list of available users in the login screen.

Your Answer

I still can login by pressing login as a different user and entering the login and password. I am still looking around to find a solution for this. Any tips? Anonymous says: Jan 19, AM. I'm still running I followed the above how to and everything seems to be working fine except for one thing. The 'Documents' folder in 'Places' under my username is not accessible, says I don't have the appropriate priveleges. When I 'Get Info' on this folder it shows an unknown user as the owner.

I'm guessing I need to make that me. By the way to get to this point, rather than run the multiple exec chowns I followed Creeture's xargs method and that seemed to work - all but this particular issue. Also note that I can access all my files. There are no files in the inaccessible 'Documents' folder and there is another 'Documents' folder directly under the Mac Harddrive - I am not a regular Mac user but would like to change that.

Finally, as per Mike, the user doesn't appear in the list but can be accessed by manually typing in the credentials from the 'Other' option. Cabeleireiro says: Jun 18, PM. So the permissions error probably had something to do with the state of that instance of Ubuntu. I had been experimenting with putting my home folder on a second hard drive.

Ed Burns says: Jun 27, PM. I didn't see anything about after some quick web searching, so I thought I'd just add on here after figuring it out. Select the desired existing group in the left pane. Ctrl click on the desired group and choose "Advanced Options You will be presented with a modal dialog in which you can edit the GID. Make sure you have a back up!!! These steps failed for me. After following described steps, I could not login with my modified user. I booted into recovery mode and repaired permissions and verified the disk.

I also used resetpassword to update the users home folder ACLs. I reset the user password for good measure, too. All to no avail. One possible difference is my HD is encrypted. I'm not sure if that is the reason or not but I now need to restore from back up. Roman says: Sep 02, PM.

First rename the home folder

Sorry to hear. Bob g says: Sep 02, PM. Roman says: Sep 03, AM. Thanks Bob, I missed that. Thanks, Roman.