umap_manual revision 1.1
11.1Smycroft
21.1Smycroft\appendix
31.1Smycroft\section{The umap Layer} \label{sect:umap}
41.1Smycroft
51.1Smycroft\subsection{Introduction}
61.1Smycroft
71.1SmycroftNormally, the file system is expected to span a single administrative domain.
81.1SmycroftAn administrative domain, for these purposes, is a machine or set of
91.1Smycroftmachines that share common password file information, usually through
101.1Smycroftthe yellow pages mechanism.  File hierarchies that span more 
111.1Smycroftthan one domain leads to certain problems, since the same numerical 
121.1SmycroftUID in one domain may correspond to a different user in another domain.  
131.1SmycroftIf the system administrator is very careful to ensure that both domains 
141.1Smycroftcontain identical user ID information, The umap layer can be used to
151.1Smycroftrun between those domains without changes
161.1Smycroft
171.1SmycroftThe umap layer is a file system layer that sits on top of the normal
181.1Smycroftfile layer.  The umap layer maps Unix-style UIDs from
191.1Smycroftone domain into the UIDs in the other domain.  By setting up the mappings
201.1Smycroftproperly, the same user with different UIDs in two domains can be seen
211.1Smycroftas the same user, from the system point of view, or, conversely, two
221.1Smycroftdifferent users with the same UID in the two domains can be distinguished.
231.1Smycroft
241.1SmycroftFirst, we define some terms.  ``User'' refers to the human (or daemon) that
251.1Smycrofthas privileges to login, run programs, and access files.  ``UID''refers to
261.1Smycroftthe numerical identifier that uniquely identifies the user within a
271.1Smycroftsingle domain.  ``Login name'' refers to the character string the user
281.1Smycrofttypes to log into the system.  ``GID'' refers to the numerical group
291.1Smycroftidentifier used by Unix systems to identify groups of users.  ``Group
301.1Smycroftname'' is the character string name attached to a particular GID in the
311.1Smycroftlocal {\sf /etc/groups} file or the yellow pages groups file.
321.1Smycroft
331.1SmycroftIn order for the umap layer to work properly, all users 
341.1Smycroftin either domain must have password file entries in both domains.  
351.1SmycroftThey do not, however, have to have the same numerical UID, nor even the 
361.1Smycroftsame character string login name (the latter is highly recommended, 
371.1Smycroftif possible, however).  Any user not having a UID in one domain will be 
381.1Smycrofttreated as the special user NOBODY by the other domain, probably with 
391.1Smycroftundesirable consequences.  Any user not owning any files in the shared
401.1Smycroftsub-trees need not be given a UID in the other domain.
411.1Smycroft
421.1SmycroftGroups work similarly.  The umap layer can translate group ID's between
431.1Smycroftdomains in the same manner as UID's.  Again, any group that wishes to
441.1Smycroftparticipate must have a group ID in both domains,
451.1Smycroftthough it need not be the same GID in both.  If a group in one domain is not
461.1Smycroftknown in the other domain, that group will be treated as being NULLGROUP.
471.1SmycroftThe umap layer has no provisions for enrolling UID's from other domains
481.1Smycroftas group members, but, since each user from each domain must have some
491.1SmycroftUID in every domain, the UID in the local domain can be used to enroll
501.1Smycroftthe user in the local groups.  
511.1Smycroft
521.1SmycroftNOBODY and NULLGROUP are special reserved UID's and GID's, respectively.
531.1SmycroftNOBODY is user 32767.  NULLGROUP is group 65534.  If the system administrator
541.1Smycroftwants to have an appropriate text string appear when these UID's are
551.1Smycroftencountered by programs like {\sf ls -l}, he should add these values to
561.1Smycroftthe password and {\sf /etc/groups} file, or to the appropriate yellow pages.  
571.1SmycroftIf these IDs are already in use in that domain, different values can be 
581.1Smycroftused for NOBODY and NULLGROUP, but that will require a recompilation of 
591.1Smycroftthe umap layer code and, as a result, the entire kernel.  These 
601.1Smycroftvalues are defined in the {\sf umap\_info.h} file, kept with the rest of the 
611.1Smycroftumap source code.
621.1Smycroft
631.1SmycroftWhen the umap layer is in use, one of the participating domains is declared 
641.1Smycroftto be the master.  All UID and GID information stored for participating files 
651.1Smycroftwill be stored in vnodes using its mappings, no matter what site the copies of 
661.1Smycroftthe files are stored at.  The master domain therefore need not run a copy 
671.1Smycroftof the umap layer, as it already has all of the correct mappings.  All 
681.1Smycroftother domains must run a umap layer on top of any other layers they use.
691.1Smycroft
701.1Smycroft\subsection{Setting Up a umap Layer}
711.1Smycroft
721.1SmycroftThe system administrator of a system needing to use the umap layer 
731.1Smycroftmust take several actions.  
741.1SmycroftFirst, he must create files containing the necessary UID
751.1Smycroftand GID mappings.  There is a separate file for user and group IDs.  The
761.1Smycroftformat of the files is the same.  The first line contains the total number
771.1Smycroftof entries in the file.  Each subsequent line contains one mapping.  A
781.1Smycroftmapping line consists of two numerical UIDs, separated by white space.
791.1SmycroftThe first is the UID of a user on the local machine.  The second is the
801.1SmycroftUID for the same user on the master machine.  The maximum number of users
811.1Smycroftthat can be mapped for a single shared sub-tree is 64.  The maximum number of
821.1Smycroftgroups that can be mapped for a single sub-tree is 16.  These constants
831.1Smycroftare set in the {\sf umap\_info.h} file, and can be changed, but changing them
841.1Smycroftrequires recompilation.  Separate mapping files can be used for each shared 
851.1Smycroftsubtree, or the same mapping files can be shared by several sub-trees.
861.1Smycroft
871.1SmycroftBelow is a sample UID mapping file.  There are four entries.  UID 5 is mapped
881.1Smycroftto 5, 521 to 521, and 7000 to 7000.  UID 2002 is mapped to 604.  On this
891.1Smycroftmachine, the UID's for users 5, 521, and 7000 are the same as on the master,
901.1Smycroftbut UID 2002 is for a user whose UID on the master machine is 604.  All
911.1Smycroftfiles in the sub-tree belonging to that user have UID 604 in their inodes,
921.1Smycrofteven on this machine, but the umap layer will ensure that anyone running
931.1Smycroftunder UID 2002 will have all files in this sub-tree owned by 604 treated as if 
941.1Smycroftthey were owned by 2002.  An {\sf ls -l} on a file owned by 604 in this sub-tree
951.1Smycroftwill show the login name associated with UID 2002 as the owner.
961.1Smycroft
971.1Smycroft\noindent4\newline
981.1Smycroft5 5\newline
991.1Smycroft521 521\newline
1001.1Smycroft2002 604\newline
1011.1Smycroft7000 7000\newline
1021.1Smycroft
1031.1SmycroftThe user and group mapping files should be owned by the root user, and
1041.1Smycroftshould be writable only by that user.  If they are not owned by root, or
1051.1Smycroftare writable by some other user, the umap mounting command will abort.
1061.1Smycroft
1071.1SmycroftNormally, the sub-treeis grafted directly into the place in
1081.1Smycroftthe file hierarchy where the it should appear to users.Using the umap
1091.1Smycroftlayer requires that the sub-tree be grafted somewhere else, and
1101.1Smycroftthe umap layer be mounted in the desired position in the file hierarchy.
1111.1SmycroftDepending on the situation, the underlying sub-tree can be wherever is
1121.1Smycroftconvenient.
1131.1Smycroft
1141.1Smycroft\subsection{Troubleshooting umap Layer Problems}
1151.1Smycroft
1161.1SmycroftThe umap layer code was not built with special convenience or
1171.1Smycroftrobustness in mind, as it is expected to be superseded with a better
1181.1Smycroftuser ID mapping strategy in the near future.  As a result, it is not
1191.1Smycroftvery forgiving of errors in being set up.  Here are some possible
1201.1Smycroftproblems, and what to do about them.
1211.1Smycroft
1221.1Smycroft\begin{itemize}
1231.1Smycroft
1241.1Smycroft
1251.1Smycroft\item{Problem: A file belongs to NOBODY, or group NULLGROUP.
1261.1Smycroft
1271.1SmycroftFixes: The mapping files don't know about this file's real user or group.  
1281.1SmycroftEither they are not in the mapping files, or the counts on the number of 
1291.1Smycroftentries in the mapping files are too low, so entries at the end (including 
1301.1Smycroftthese) are being ignored.  Add the entries or fix the counts, and either
1311.1Smycroftunmount and remount the sub-tree, or reboot.}
1321.1Smycroft
1331.1Smycroft\item{Problem: A normal operation does not work.
1341.1Smycroft
1351.1SmycroftFixes: Possibly, some mapping has not been set properly.  Check to
1361.1Smycroftsee which files are used by the operation and who they appear to be
1371.1Smycroftowned by.  If they are owned by NOBODY or some other suspicious user,
1381.1Smycroftthere may be a problem in the mapping files.  Be sure to check groups,
1391.1Smycrofttoo.  As above, if the counts of mappings in the mapping files are lower 
1401.1Smycroftthan the actual numbers of pairs, pairs at the end of the file will be 
1411.1Smycroftignored.  If any changes are made in the mapping files, you will need to 
1421.1Smycrofteither unmount and remount or reboot before they will take effect.
1431.1Smycroft
1441.1SmycroftAnother possible problem can arise because not all Unix utilities
1451.1Smycroftrely exclusively on numeric UID for identification.  For instance, 
1461.1SmycroftSCCS saves the login name in files.  If a user's login name on two machines
1471.1Smycroftisn't the same, SCCS may veto an operation even though Unix file permissions,
1481.1Smycroftas checked by the umap layer, may say it's OK.  There's not much to be
1491.1Smycroftdone in such cases, unless the login name can be changed or one fiddles
1501.1Smycroftimproperly with SCCS information.  There may be other, undiscovered cases
1511.1Smycroftwhere similar problems arise, some of which may be even harder to handle.}
1521.1Smycroft
1531.1Smycroft\item{Problem: Someone has access permissions he should not have.
1541.1Smycroft
1551.1SmycroftFixes: This is probably caused by a mistake in the mapping files.  Check 
1561.1Smycroftboth user and group mapping files.  If any changes are made in the mapping 
1571.1Smycroftfiles, you will need to unmount and remount the sub-tree or reboot before they 
1581.1Smycroftwill take effect.}
1591.1Smycroft
1601.1Smycroft\item{Problem: {\sf ls -l} (or a similar program) shows the wrong user for a file.
1611.1Smycroft
1621.1SmycroftFixes: Probably a mistake in the mapping files.  In particular, if
1631.1Smycrofttwo local UIDs are mapped to a single master UID, stat calls will assign
1641.1Smycroftownership to the first local UID occurring in the file, which may or may
1651.1Smycroftnot be what was intended.  (Generally speaking, mapping two local UIDs to
1661.1Smycrofta single master UID is a bad idea, but the software will not prevent it.
1671.1SmycroftSimilarly, mapping a single local UID to two master UIDs is a bad idea,
1681.1Smycroftbut will not be prevented.  In this case, only the first mapping of the
1691.1Smycroftlocal UID will be done.  The second, and all subsequent ones, will be 
1701.1Smycroftignored.) If any changes are made in the mapping files, you will need to 
1711.1Smycroftunmount and remount the sub-tree or reboot before they will take effect.}
1721.1Smycroft
1731.1Smycroft\end{itemize}
1741.1Smycroft
1751.1Smycroft\end{document}
176