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

Tom Haynes

loghyr.com
excfb.com

Blogs to Gander At

Navigation

Editing

AllMarks

Referers

Today's Page Hits: 334

Powered by Roller Weblogger.

statcounter.com

clustrmaps.com

Locations of visitors to this page

technorati.com

www.alesti.org

Add to Alesti RSS Reader

South Park as I was 10 years ago

South Park Fantasy

South Park today

South Park Reality

I have more hair and it isn't so grey. :->

10 years ago, really

Toon Tom

Today, literally

Tom Today

Site notes

This page validates as XHTML 1.0, and will look much better in a browser that supports web standards, but it is accessible to any browser or Internet device. It was created using techniques detailed at glish.com/css/.

« And the side panels... | Main | Getting a Solaris... »
20070115 Monday January 15, 2007
A quick overview of UIDs vs usernames

I was able to recover my ZFS filesystem when I reinstalled Solaris. If I had known I was going to nuke the root partition, I would have done something like zpool export zoo to make sure it could be imported to a new machine. Since I didn't I had to recover it via zpool import -f zoo.

If we were to take a look at the home directories right then, we see:

# ls -al /export/zfs
total 26
drwxr-xr-x   7 root     sys            7 Jan 14 14:25 .
drwxr-xr-x   4 root     sys          512 Jan 14 23:55 ..
drwxr-xr-x   2 2025     100            2 Jan 14 14:25 monster
drwxr-xr-x   2 1094     100            2 Jan 14 14:10 nfsv2
drwxr-xr-x   2 1813     100            2 Jan 14 14:10 nfsv3
drwxr-xr-x   2 3530     100            2 Jan 14 14:11 nfsv4
drwxr-xr-x   2 1066     staff          3 Jan 14 14:24 tdh

So, we see names for root, sys, and staff. We don't see names for uid 1066, gid 100, etc. The reason why is that ownership is stored by a numeric value in the inode and not a string name. And we do not have a mapping for these uids to names. We can fix that easily:

# grep tdh /etc/passwd
# grep users /etc/group
# echo "users::100:" >> /etc/group
# useradd -m -u 1066 -g 10 -c "Tom Haynes" -s /bin/tcsh -d /export/zfs/tdh tdh
# useradd -m -u 1094 -g 100 -c "Mr. NFSv2" -d /export/zfs/nfsv2 nfsv2
# grep users /etc/group
users::100:
# grep tdh /etc/passwd
tdh:x:1066:10:Tom Haynes:/export/zfs/tdh:/bin/tcsh
# ls -al /export/zfs
total 26
drwxr-xr-x   7 root     sys            7 Jan 14 14:25 .
drwxr-xr-x   4 root     sys          512 Jan 14 23:55 ..
drwxr-xr-x   2 2025     users          2 Jan 14 14:25 monster
drwxr-xr-x   2 nfsv2    users          2 Jan 14 14:10 nfsv2
drwxr-xr-x   2 1813     users          2 Jan 14 14:10 nfsv3
drwxr-xr-x   2 3530     users          2 Jan 14 14:11 nfsv4
drwxr-xr-x   2 tdh      staff          3 Jan 14 14:24 tdh

We can see that right away the new accounts are reflected in the directory output and that even if there is no corresponding user, we can see a group.

So if you are looking at the output of ls -la and the user or group is a number, then it means that number does not have a corresponding entry in the name service. On a NFSv2/v3 mounted filesystem, it might mean that while the server can see the entry, the client can not. Or it could mean that the server supports more users than the client. With NFSv4, you would see the string nobody, which effectively prevents you from seeing the UID.


Orginally posted on Kool Aid Served Daily
Copyright (C) 2007, Kool Aid Served Daily

Trackback URL: http://blogs.sun.com/tdh/entry/a_quick_overview_of_uids
Comments:

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed
Copyright (C) 2007, Kool Aid Served Daily