xref: /netbsd-src/sbin/mount_umap/umap_manual (revision 0114e805cee953f6d604ea8f30b6171d04e55c94)
1*0114e805Scgd%	$NetBSD: umap_manual,v 1.2 1995/03/18 14:58:19 cgd Exp $
2625a6892Smycroft
3625a6892Smycroft\appendix
4625a6892Smycroft\section{The umap Layer} \label{sect:umap}
5625a6892Smycroft
6625a6892Smycroft\subsection{Introduction}
7625a6892Smycroft
8625a6892SmycroftNormally, the file system is expected to span a single administrative domain.
9625a6892SmycroftAn administrative domain, for these purposes, is a machine or set of
10625a6892Smycroftmachines that share common password file information, usually through
11625a6892Smycroftthe yellow pages mechanism.  File hierarchies that span more
12625a6892Smycroftthan one domain leads to certain problems, since the same numerical
13625a6892SmycroftUID in one domain may correspond to a different user in another domain.
14625a6892SmycroftIf the system administrator is very careful to ensure that both domains
15625a6892Smycroftcontain identical user ID information, The umap layer can be used to
16625a6892Smycroftrun between those domains without changes
17625a6892Smycroft
18625a6892SmycroftThe umap layer is a file system layer that sits on top of the normal
19625a6892Smycroftfile layer.  The umap layer maps Unix-style UIDs from
20625a6892Smycroftone domain into the UIDs in the other domain.  By setting up the mappings
21625a6892Smycroftproperly, the same user with different UIDs in two domains can be seen
22625a6892Smycroftas the same user, from the system point of view, or, conversely, two
23625a6892Smycroftdifferent users with the same UID in the two domains can be distinguished.
24625a6892Smycroft
25625a6892SmycroftFirst, we define some terms.  ``User'' refers to the human (or daemon) that
26625a6892Smycrofthas privileges to login, run programs, and access files.  ``UID''refers to
27625a6892Smycroftthe numerical identifier that uniquely identifies the user within a
28625a6892Smycroftsingle domain.  ``Login name'' refers to the character string the user
29625a6892Smycrofttypes to log into the system.  ``GID'' refers to the numerical group
30625a6892Smycroftidentifier used by Unix systems to identify groups of users.  ``Group
31625a6892Smycroftname'' is the character string name attached to a particular GID in the
32625a6892Smycroftlocal {\sf /etc/groups} file or the yellow pages groups file.
33625a6892Smycroft
34625a6892SmycroftIn order for the umap layer to work properly, all users
35625a6892Smycroftin either domain must have password file entries in both domains.
36625a6892SmycroftThey do not, however, have to have the same numerical UID, nor even the
37625a6892Smycroftsame character string login name (the latter is highly recommended,
38625a6892Smycroftif possible, however).  Any user not having a UID in one domain will be
39625a6892Smycrofttreated as the special user NOBODY by the other domain, probably with
40625a6892Smycroftundesirable consequences.  Any user not owning any files in the shared
41625a6892Smycroftsub-trees need not be given a UID in the other domain.
42625a6892Smycroft
43625a6892SmycroftGroups work similarly.  The umap layer can translate group ID's between
44625a6892Smycroftdomains in the same manner as UID's.  Again, any group that wishes to
45625a6892Smycroftparticipate must have a group ID in both domains,
46625a6892Smycroftthough it need not be the same GID in both.  If a group in one domain is not
47625a6892Smycroftknown in the other domain, that group will be treated as being NULLGROUP.
48625a6892SmycroftThe umap layer has no provisions for enrolling UID's from other domains
49625a6892Smycroftas group members, but, since each user from each domain must have some
50625a6892SmycroftUID in every domain, the UID in the local domain can be used to enroll
51625a6892Smycroftthe user in the local groups.
52625a6892Smycroft
53625a6892SmycroftNOBODY and NULLGROUP are special reserved UID's and GID's, respectively.
54625a6892SmycroftNOBODY is user 32767.  NULLGROUP is group 65534.  If the system administrator
55625a6892Smycroftwants to have an appropriate text string appear when these UID's are
56625a6892Smycroftencountered by programs like {\sf ls -l}, he should add these values to
57625a6892Smycroftthe password and {\sf /etc/groups} file, or to the appropriate yellow pages.
58625a6892SmycroftIf these IDs are already in use in that domain, different values can be
59625a6892Smycroftused for NOBODY and NULLGROUP, but that will require a recompilation of
60625a6892Smycroftthe umap layer code and, as a result, the entire kernel.  These
61625a6892Smycroftvalues are defined in the {\sf umap\_info.h} file, kept with the rest of the
62625a6892Smycroftumap source code.
63625a6892Smycroft
64625a6892SmycroftWhen the umap layer is in use, one of the participating domains is declared
65625a6892Smycroftto be the master.  All UID and GID information stored for participating files
66625a6892Smycroftwill be stored in vnodes using its mappings, no matter what site the copies of
67625a6892Smycroftthe files are stored at.  The master domain therefore need not run a copy
68625a6892Smycroftof the umap layer, as it already has all of the correct mappings.  All
69625a6892Smycroftother domains must run a umap layer on top of any other layers they use.
70625a6892Smycroft
71625a6892Smycroft\subsection{Setting Up a umap Layer}
72625a6892Smycroft
73625a6892SmycroftThe system administrator of a system needing to use the umap layer
74625a6892Smycroftmust take several actions.
75625a6892SmycroftFirst, he must create files containing the necessary UID
76625a6892Smycroftand GID mappings.  There is a separate file for user and group IDs.  The
77625a6892Smycroftformat of the files is the same.  The first line contains the total number
78625a6892Smycroftof entries in the file.  Each subsequent line contains one mapping.  A
79625a6892Smycroftmapping line consists of two numerical UIDs, separated by white space.
80625a6892SmycroftThe first is the UID of a user on the local machine.  The second is the
81625a6892SmycroftUID for the same user on the master machine.  The maximum number of users
82625a6892Smycroftthat can be mapped for a single shared sub-tree is 64.  The maximum number of
83625a6892Smycroftgroups that can be mapped for a single sub-tree is 16.  These constants
84625a6892Smycroftare set in the {\sf umap\_info.h} file, and can be changed, but changing them
85625a6892Smycroftrequires recompilation.  Separate mapping files can be used for each shared
86625a6892Smycroftsubtree, or the same mapping files can be shared by several sub-trees.
87625a6892Smycroft
88625a6892SmycroftBelow is a sample UID mapping file.  There are four entries.  UID 5 is mapped
89625a6892Smycroftto 5, 521 to 521, and 7000 to 7000.  UID 2002 is mapped to 604.  On this
90625a6892Smycroftmachine, the UID's for users 5, 521, and 7000 are the same as on the master,
91625a6892Smycroftbut UID 2002 is for a user whose UID on the master machine is 604.  All
92625a6892Smycroftfiles in the sub-tree belonging to that user have UID 604 in their inodes,
93625a6892Smycrofteven on this machine, but the umap layer will ensure that anyone running
94625a6892Smycroftunder UID 2002 will have all files in this sub-tree owned by 604 treated as if
95625a6892Smycroftthey were owned by 2002.  An {\sf ls -l} on a file owned by 604 in this sub-tree
96625a6892Smycroftwill show the login name associated with UID 2002 as the owner.
97625a6892Smycroft
98625a6892Smycroft\noindent4\newline
99625a6892Smycroft5 5\newline
100625a6892Smycroft521 521\newline
101625a6892Smycroft2002 604\newline
102625a6892Smycroft7000 7000\newline
103625a6892Smycroft
104625a6892SmycroftThe user and group mapping files should be owned by the root user, and
105625a6892Smycroftshould be writable only by that user.  If they are not owned by root, or
106625a6892Smycroftare writable by some other user, the umap mounting command will abort.
107625a6892Smycroft
108625a6892SmycroftNormally, the sub-treeis grafted directly into the place in
109625a6892Smycroftthe file hierarchy where the it should appear to users.Using the umap
110625a6892Smycroftlayer requires that the sub-tree be grafted somewhere else, and
111625a6892Smycroftthe umap layer be mounted in the desired position in the file hierarchy.
112625a6892SmycroftDepending on the situation, the underlying sub-tree can be wherever is
113625a6892Smycroftconvenient.
114625a6892Smycroft
115625a6892Smycroft\subsection{Troubleshooting umap Layer Problems}
116625a6892Smycroft
117625a6892SmycroftThe umap layer code was not built with special convenience or
118625a6892Smycroftrobustness in mind, as it is expected to be superseded with a better
119625a6892Smycroftuser ID mapping strategy in the near future.  As a result, it is not
120625a6892Smycroftvery forgiving of errors in being set up.  Here are some possible
121625a6892Smycroftproblems, and what to do about them.
122625a6892Smycroft
123625a6892Smycroft\begin{itemize}
124625a6892Smycroft
125625a6892Smycroft
126625a6892Smycroft\item{Problem: A file belongs to NOBODY, or group NULLGROUP.
127625a6892Smycroft
128625a6892SmycroftFixes: The mapping files don't know about this file's real user or group.
129625a6892SmycroftEither they are not in the mapping files, or the counts on the number of
130625a6892Smycroftentries in the mapping files are too low, so entries at the end (including
131625a6892Smycroftthese) are being ignored.  Add the entries or fix the counts, and either
132625a6892Smycroftunmount and remount the sub-tree, or reboot.}
133625a6892Smycroft
134625a6892Smycroft\item{Problem: A normal operation does not work.
135625a6892Smycroft
136625a6892SmycroftFixes: Possibly, some mapping has not been set properly.  Check to
137625a6892Smycroftsee which files are used by the operation and who they appear to be
138625a6892Smycroftowned by.  If they are owned by NOBODY or some other suspicious user,
139625a6892Smycroftthere may be a problem in the mapping files.  Be sure to check groups,
140625a6892Smycrofttoo.  As above, if the counts of mappings in the mapping files are lower
141625a6892Smycroftthan the actual numbers of pairs, pairs at the end of the file will be
142625a6892Smycroftignored.  If any changes are made in the mapping files, you will need to
143625a6892Smycrofteither unmount and remount or reboot before they will take effect.
144625a6892Smycroft
145625a6892SmycroftAnother possible problem can arise because not all Unix utilities
146625a6892Smycroftrely exclusively on numeric UID for identification.  For instance,
147625a6892SmycroftSCCS saves the login name in files.  If a user's login name on two machines
148625a6892Smycroftisn't the same, SCCS may veto an operation even though Unix file permissions,
149625a6892Smycroftas checked by the umap layer, may say it's OK.  There's not much to be
150625a6892Smycroftdone in such cases, unless the login name can be changed or one fiddles
151625a6892Smycroftimproperly with SCCS information.  There may be other, undiscovered cases
152625a6892Smycroftwhere similar problems arise, some of which may be even harder to handle.}
153625a6892Smycroft
154625a6892Smycroft\item{Problem: Someone has access permissions he should not have.
155625a6892Smycroft
156625a6892SmycroftFixes: This is probably caused by a mistake in the mapping files.  Check
157625a6892Smycroftboth user and group mapping files.  If any changes are made in the mapping
158625a6892Smycroftfiles, you will need to unmount and remount the sub-tree or reboot before they
159625a6892Smycroftwill take effect.}
160625a6892Smycroft
161625a6892Smycroft\item{Problem: {\sf ls -l} (or a similar program) shows the wrong user for a file.
162625a6892Smycroft
163625a6892SmycroftFixes: Probably a mistake in the mapping files.  In particular, if
164625a6892Smycrofttwo local UIDs are mapped to a single master UID, stat calls will assign
165625a6892Smycroftownership to the first local UID occurring in the file, which may or may
166625a6892Smycroftnot be what was intended.  (Generally speaking, mapping two local UIDs to
167625a6892Smycrofta single master UID is a bad idea, but the software will not prevent it.
168625a6892SmycroftSimilarly, mapping a single local UID to two master UIDs is a bad idea,
169625a6892Smycroftbut will not be prevented.  In this case, only the first mapping of the
170625a6892Smycroftlocal UID will be done.  The second, and all subsequent ones, will be
171625a6892Smycroftignored.) If any changes are made in the mapping files, you will need to
172625a6892Smycroftunmount and remount the sub-tree or reboot before they will take effect.}
173625a6892Smycroft
174625a6892Smycroft\end{itemize}
175625a6892Smycroft
176625a6892Smycroft\end{document}
177