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