Science Daily: Jupiter
- Heart of Jovian moon's volcanic rage December 13, 2024
- NASA's Hubble celebrates decade of tracking outer planets December 9, 2024
Okay, this is not an astronomy topic, but I got stumped on this for a long time and searching the web, while helpful, didn’t make it exactly obvious. Why would you even want to change GID or UID? Well, I needed to synchronize UID and GID with my NFS server for file sharing. We have two Macs and the accounts had been set up at different times so the UIDs were not the same. I’d already modified everything on the server to match my wife’s iMac G5, and changed things on my Linux laptop to match both of those, so now I had to make the MacBook match the other machines.
The first thing is that changing the nominal user and group ID is simple. But do not try to do this on the account you are logged in as. Create a new, temporary administrator account. Once that’s done, you can proceed with impunity (well, not really…).
Use the System Preference -> System -> Accounts to change the user account. Right-click on the user to bring up the "Advanced Options" menu. You now change the user and group ID.
Once that is done, you will need to open a Terminal window and run chown to change the ownership of the files. Assuming all of the user’s files are in /Users/roland (like mine were), and that the new UID and GID are both 502 (whatever you set in the "Advanced Options" window),
cd /Users
chown -R 502:502 roland
I did the same thing for my wife’s account, but with UID:GID = 501:501 effectively swapping the for our old accounts.
The last remaining problem was to modify the group mappings. When I did a directory listing in /Users, I found the group names hadn’t switched. I suspected they wouldn’t which is why I was looking:
ptolemy-wl:Users tempadmin$ ls -l
total 0
drwxrwx--- 5 root admin 170 Dec 22 2007 Deleted Users
drwxrwxrwt 12 root wheel 408 Dec 29 2007 Shared
drwxr-xr-x+ 16 jonathan jonathan 544 Dec 30 2007 jonathan
drwxr-xr-x+ 17 maria roland 578 Aug 16 09:22 maria
drwxr-xr-x+ 20 matthew matthew 680 Aug 9 14:58 matthew
drwxr-xr-x+ 30 roland maria 1020 Aug 17 19:33 roland
drwxr-xr-x+ 16 tempadmin staff 544 Aug 17 20:10 tempadmin
The last remaining trick is with the new "Directory Services Command Line" tool, aka dscl. You’ll need to do something like this:
ptolemy-wl:Users tempadmin$ sudo dscl
Password:
Entering interactive mode... (type "help" for commands)
> change /Local/Default/Groups/roland PrimaryGroupID 501 502
> read /Local/Default/Groups/roland
AppleMetaNodeLocation: /Local/Default
GeneratedUID: A080E0BB-163E-4DC3-AA15-8A784AECC916
Password: *
PrimaryGroupID: 502
RecordName: roland
RecordType: dsRecTypeStandard:Groups
> change /Local/Default/Groups/maria PrimaryGroupID 502 501
> quit
Goodbye
ptolemy-wl:Users tempadmin$ ls -l
total 0
drwxrwx--- 5 root admin 170 Dec 22 2007 Deleted Users
drwxrwxrwt 12 root wheel 408 Dec 29 2007 Shared
drwxr-xr-x+ 16 jonathan jonathan 544 Dec 30 2007 jonathan
drwxr-xr-x+ 17 maria maria 578 Aug 16 09:22 maria
drwxr-xr-x+ 20 matthew matthew 680 Aug 9 14:58 matthew
drwxr-xr-x+ 30 roland roland 1020 Aug 17 19:33 roland
drwxr-xr-x+ 16 tempadmin staff 544 Aug 17 20:10 tempadmin
And as you can see, now the group names are mapped correctly, too.
Written by Roland Roberts
Search
.Archives
- October 2024 (1)
- May 2024 (2)
- April 2024 (3)
- September 2022 (5)
- April 2022 (1)
- January 2022 (3)
- December 2021 (4)
- September 2021 (3)
- July 2021 (1)
- January 2021 (1)
- November 2020 (2)
- October 2020 (2)
- September 2020 (2)
- August 2020 (5)
- July 2020 (1)
- November 2019 (2)
- September 2019 (1)
- August 2019 (2)
- September 2017 (1)
- August 2017 (1)
- September 2015 (3)
- August 2015 (2)
- June 2015 (5)
- May 2015 (3)
- May 2013 (2)
- January 2013 (1)
- December 2012 (2)
- September 2012 (1)
- June 2012 (1)
- May 2012 (1)
- October 2011 (2)
- September 2011 (2)
- April 2011 (2)
- March 2011 (10)
- January 2011 (8)
- November 2010 (2)
- October 2010 (1)
- September 2010 (3)
- August 2010 (2)
- July 2010 (1)
- June 2010 (1)
- April 2010 (3)
- February 2010 (3)
- January 2010 (3)
- December 2009 (6)
- November 2009 (3)
- October 2009 (7)
- September 2009 (8)
- August 2009 (4)
- July 2009 (1)
- June 2009 (2)
- May 2009 (2)
- April 2009 (7)
- March 2009 (1)
- February 2009 (6)
- January 2009 (4)
- December 2008 (4)
- November 2008 (3)
- October 2008 (11)
- September 2008 (4)
- August 2008 (5)
- July 2008 (5)
- June 2008 (2)
- April 2008 (4)
- March 2008 (18)
- February 2008 (9)
- November 2007 (1)
- October 2007 (3)
- July 2007 (3)
- April 2007 (1)
- March 2007 (6)
- February 2007 (3)
- December 2006 (3)
- October 2006 (4)
- September 2006 (1)
- July 2006 (5)
- May 2006 (10)
- April 2006 (9)