Home | History | Annotate | Line # | Download | only in mount_umap
      1 %	$NetBSD: umap_manual,v 1.2 1995/03/18 14:58:19 cgd Exp $
      2 
      3 \appendix
      4 \section{The umap Layer} \label{sect:umap}
      5 
      6 \subsection{Introduction}
      7 
      8 Normally, the file system is expected to span a single administrative domain.
      9 An administrative domain, for these purposes, is a machine or set of
     10 machines that share common password file information, usually through
     11 the yellow pages mechanism.  File hierarchies that span more 
     12 than one domain leads to certain problems, since the same numerical 
     13 UID in one domain may correspond to a different user in another domain.  
     14 If the system administrator is very careful to ensure that both domains 
     15 contain identical user ID information, The umap layer can be used to
     16 run between those domains without changes
     17 
     18 The umap layer is a file system layer that sits on top of the normal
     19 file layer.  The umap layer maps Unix-style UIDs from
     20 one domain into the UIDs in the other domain.  By setting up the mappings
     21 properly, the same user with different UIDs in two domains can be seen
     22 as the same user, from the system point of view, or, conversely, two
     23 different users with the same UID in the two domains can be distinguished.
     24 
     25 First, we define some terms.  ``User'' refers to the human (or daemon) that
     26 has privileges to login, run programs, and access files.  ``UID''refers to
     27 the numerical identifier that uniquely identifies the user within a
     28 single domain.  ``Login name'' refers to the character string the user
     29 types to log into the system.  ``GID'' refers to the numerical group
     30 identifier used by Unix systems to identify groups of users.  ``Group
     31 name'' is the character string name attached to a particular GID in the
     32 local {\sf /etc/groups} file or the yellow pages groups file.
     33 
     34 In order for the umap layer to work properly, all users 
     35 in either domain must have password file entries in both domains.  
     36 They do not, however, have to have the same numerical UID, nor even the 
     37 same character string login name (the latter is highly recommended, 
     38 if possible, however).  Any user not having a UID in one domain will be 
     39 treated as the special user NOBODY by the other domain, probably with 
     40 undesirable consequences.  Any user not owning any files in the shared
     41 sub-trees need not be given a UID in the other domain.
     42 
     43 Groups work similarly.  The umap layer can translate group ID's between
     44 domains in the same manner as UID's.  Again, any group that wishes to
     45 participate must have a group ID in both domains,
     46 though it need not be the same GID in both.  If a group in one domain is not
     47 known in the other domain, that group will be treated as being NULLGROUP.
     48 The umap layer has no provisions for enrolling UID's from other domains
     49 as group members, but, since each user from each domain must have some
     50 UID in every domain, the UID in the local domain can be used to enroll
     51 the user in the local groups.  
     52 
     53 NOBODY and NULLGROUP are special reserved UID's and GID's, respectively.
     54 NOBODY is user 32767.  NULLGROUP is group 65534.  If the system administrator
     55 wants to have an appropriate text string appear when these UID's are
     56 encountered by programs like {\sf ls -l}, he should add these values to
     57 the password and {\sf /etc/groups} file, or to the appropriate yellow pages.  
     58 If these IDs are already in use in that domain, different values can be 
     59 used for NOBODY and NULLGROUP, but that will require a recompilation of 
     60 the umap layer code and, as a result, the entire kernel.  These 
     61 values are defined in the {\sf umap\_info.h} file, kept with the rest of the 
     62 umap source code.
     63 
     64 When the umap layer is in use, one of the participating domains is declared 
     65 to be the master.  All UID and GID information stored for participating files 
     66 will be stored in vnodes using its mappings, no matter what site the copies of 
     67 the files are stored at.  The master domain therefore need not run a copy 
     68 of the umap layer, as it already has all of the correct mappings.  All 
     69 other domains must run a umap layer on top of any other layers they use.
     70 
     71 \subsection{Setting Up a umap Layer}
     72 
     73 The system administrator of a system needing to use the umap layer 
     74 must take several actions.  
     75 First, he must create files containing the necessary UID
     76 and GID mappings.  There is a separate file for user and group IDs.  The
     77 format of the files is the same.  The first line contains the total number
     78 of entries in the file.  Each subsequent line contains one mapping.  A
     79 mapping line consists of two numerical UIDs, separated by white space.
     80 The first is the UID of a user on the local machine.  The second is the
     81 UID for the same user on the master machine.  The maximum number of users
     82 that can be mapped for a single shared sub-tree is 64.  The maximum number of
     83 groups that can be mapped for a single sub-tree is 16.  These constants
     84 are set in the {\sf umap\_info.h} file, and can be changed, but changing them
     85 requires recompilation.  Separate mapping files can be used for each shared 
     86 subtree, or the same mapping files can be shared by several sub-trees.
     87 
     88 Below is a sample UID mapping file.  There are four entries.  UID 5 is mapped
     89 to 5, 521 to 521, and 7000 to 7000.  UID 2002 is mapped to 604.  On this
     90 machine, the UID's for users 5, 521, and 7000 are the same as on the master,
     91 but UID 2002 is for a user whose UID on the master machine is 604.  All
     92 files in the sub-tree belonging to that user have UID 604 in their inodes,
     93 even on this machine, but the umap layer will ensure that anyone running
     94 under UID 2002 will have all files in this sub-tree owned by 604 treated as if 
     95 they were owned by 2002.  An {\sf ls -l} on a file owned by 604 in this sub-tree
     96 will show the login name associated with UID 2002 as the owner.
     97 
     98 \noindent4\newline
     99 5 5\newline
    100 521 521\newline
    101 2002 604\newline
    102 7000 7000\newline
    103 
    104 The user and group mapping files should be owned by the root user, and
    105 should be writable only by that user.  If they are not owned by root, or
    106 are writable by some other user, the umap mounting command will abort.
    107 
    108 Normally, the sub-treeis grafted directly into the place in
    109 the file hierarchy where the it should appear to users.Using the umap
    110 layer requires that the sub-tree be grafted somewhere else, and
    111 the umap layer be mounted in the desired position in the file hierarchy.
    112 Depending on the situation, the underlying sub-tree can be wherever is
    113 convenient.
    114 
    115 \subsection{Troubleshooting umap Layer Problems}
    116 
    117 The umap layer code was not built with special convenience or
    118 robustness in mind, as it is expected to be superseded with a better
    119 user ID mapping strategy in the near future.  As a result, it is not
    120 very forgiving of errors in being set up.  Here are some possible
    121 problems, and what to do about them.
    122 
    123 \begin{itemize}
    124 
    125 
    126 \item{Problem: A file belongs to NOBODY, or group NULLGROUP.
    127 
    128 Fixes: The mapping files don't know about this file's real user or group.  
    129 Either they are not in the mapping files, or the counts on the number of 
    130 entries in the mapping files are too low, so entries at the end (including 
    131 these) are being ignored.  Add the entries or fix the counts, and either
    132 unmount and remount the sub-tree, or reboot.}
    133 
    134 \item{Problem: A normal operation does not work.
    135 
    136 Fixes: Possibly, some mapping has not been set properly.  Check to
    137 see which files are used by the operation and who they appear to be
    138 owned by.  If they are owned by NOBODY or some other suspicious user,
    139 there may be a problem in the mapping files.  Be sure to check groups,
    140 too.  As above, if the counts of mappings in the mapping files are lower 
    141 than the actual numbers of pairs, pairs at the end of the file will be 
    142 ignored.  If any changes are made in the mapping files, you will need to 
    143 either unmount and remount or reboot before they will take effect.
    144 
    145 Another possible problem can arise because not all Unix utilities
    146 rely exclusively on numeric UID for identification.  For instance, 
    147 SCCS saves the login name in files.  If a user's login name on two machines
    148 isn't the same, SCCS may veto an operation even though Unix file permissions,
    149 as checked by the umap layer, may say it's OK.  There's not much to be
    150 done in such cases, unless the login name can be changed or one fiddles
    151 improperly with SCCS information.  There may be other, undiscovered cases
    152 where similar problems arise, some of which may be even harder to handle.}
    153 
    154 \item{Problem: Someone has access permissions he should not have.
    155 
    156 Fixes: This is probably caused by a mistake in the mapping files.  Check 
    157 both user and group mapping files.  If any changes are made in the mapping 
    158 files, you will need to unmount and remount the sub-tree or reboot before they 
    159 will take effect.}
    160 
    161 \item{Problem: {\sf ls -l} (or a similar program) shows the wrong user for a file.
    162 
    163 Fixes: Probably a mistake in the mapping files.  In particular, if
    164 two local UIDs are mapped to a single master UID, stat calls will assign
    165 ownership to the first local UID occurring in the file, which may or may
    166 not be what was intended.  (Generally speaking, mapping two local UIDs to
    167 a single master UID is a bad idea, but the software will not prevent it.
    168 Similarly, mapping a single local UID to two master UIDs is a bad idea,
    169 but will not be prevented.  In this case, only the first mapping of the
    170 local UID will be done.  The second, and all subsequent ones, will be 
    171 ignored.) If any changes are made in the mapping files, you will need to 
    172 unmount and remount the sub-tree or reboot before they will take effect.}
    173 
    174 \end{itemize}
    175 
    176 \end{document}
    177