Changing your uid on Mac OS X

Since I'm going to turn my brand new Ultra 40 into a NFS server, I have to match the uid on Mac OS X with Solaris.

Being an UNIX geek, I immediately created a temporary admin account and ran sudo vi /etc/passwd only to be baffeled by the fact that the user martin wasn't there! Then I glanced at the comment at the top of the file. It turns out that /etc/passwd is only used when you boot into single user mode, instead I should be looking using the NetInfo program.

Once my uid and gid had been changed, I ran two onliners to change the user and group of all files and directories I own:

# find / -user 501 -print0 | xargs -0 chown -h martin
find: /dev/fd/3: Bad file descriptor
# find / -group 501 -print0 | xargs -0 chgrp -h martin
find: /dev/fd/3: Bad file descriptor
And I could log out of my temporary admin account and start using my normal account again.

Comments:

Post a Comment:
Comments are closed for this entry.
About

martin

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today