xref: /netbsd/sbin/mount_umap/mount_umap.8 (revision c4a72b64)
1.\"	$NetBSD: mount_umap.8,v 1.15 2002/10/01 13:40:44 wiz Exp $
2.\"
3.\" Copyright (c) 1992, 1993, 1994
4.\"	The Regents of the University of California.  All rights reserved.
5.\" All rights reserved.
6.\"
7.\" This code is derived from software donated to Berkeley by
8.\" Jan-Simon Pendry and from John Heidemann of the UCLA Ficus project.
9.\"
10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions
12.\" are met:
13.\" 1. Redistributions of source code must retain the above copyright
14.\"    notice, this list of conditions and the following disclaimer.
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice, this list of conditions and the following disclaimer in the
17.\"    documentation and/or other materials provided with the distribution.
18.\" 3. All advertising materials mentioning features or use of this software
19.\"    must display the following acknowledgement:
20.\"	This product includes software developed by the University of
21.\"	California, Berkeley and its contributors.
22.\" 4. Neither the name of the University nor the names of its contributors
23.\"    may be used to endorse or promote products derived from this software
24.\"    without specific prior written permission.
25.\"
26.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36.\" SUCH DAMAGE.
37.\"
38.\"	@(#)mount_umap.8	8.4 (Berkeley) 5/1/95
39.\"
40.Dd March 6, 2001
41.Dt MOUNT_UMAP 8
42.Os
43.Sh NAME
44.Nm mount_umap
45.Nd user and group ID remapping file system layer
46.Sh SYNOPSIS
47.Nm ""
48.Op Fl o Ar options
49-u
50.Ar uid-mapfile
51-g
52.Ar gid-mapfile
53.Ar target
54.Ar mount-point
55.Sh DESCRIPTION
56The
57.Nm
58command is used to mount a sub-tree of an existing file system
59that uses a different set of uids and gids than the local system.
60Such a file system could be mounted from a remote site via NFS,
61a local file system on removable media brought from some foreign
62location that uses a different user/group database, or could be
63a local file system for another operating system which does not
64support Unix-style user/group IDs, or which uses a different
65numbering scheme.
66.Pp
67The options are as follows:
68.Bl -tag -width indent
69.It Fl o
70Options are specified with a
71.Fl o
72flag followed by a comma separated string of options.
73See the
74.Xr mount 8
75man page for possible options and their meanings.
76.It Fl g Ar gid-mapfile
77Use the group ID mapping specified in
78.Ar gid-mapfile .
79This flag is required.
80.It Fl u Ar uid-mapfile
81Use the user ID mapping specified in
82.Ar uid-mapfile .
83This flag is required.
84.El
85.Pp
86The
87.Nm
88command uses a set of files provided by the user to make correspondences
89between uids and gids in the sub-tree's original environment and
90some other set of ids in the local environment.
91For instance, user smith might have uid 1000 in the original environment,
92while having uid 2000 in the local environment.
93The
94.Nm
95command allows the subtree from smith's original environment to be
96mapped in such a way that all files with owning uid 1000 look like
97they are actually owned by uid 2000.
98.Pp
99.Em target
100should be the current location of the sub-tree in the
101local system's name space.
102.Em mount-point
103should be a directory
104where the mapped subtree is to be placed.
105.Em uid-mapfile
106and
107.Em gid-mapfile
108describe the mappings to be made between identifiers.
109.Pp
110The format of the user and group ID mapping files is very simple.
111The first line of the file is the total number of mappings present
112in the file.
113The remaining lines each consist of two numbers: the
114ID in the mapped subtree and the ID in the original subtree.
115.Pp
116For example, to map uid 1000 in the original subtree to uid 2000
117in the mapped subtree:
118.Bd -unfilled -offset indent
1191
1202000 1000
121.Ed
122.Pp
123For user IDs in the original subtree for which no mapping exists,
124the user ID will be mapped to the user
125.Dq nobody .
126For group IDs in the original subtree for which no mapping exists,
127the group ID will be mapped to the group
128.Dq nobody .
129.Pp
130There is a limit of 64 user ID mappings and 16 group ID mappings.
131.Pp
132The mapfiles can be located anywhere in the file hierarchy, but they
133must be owned by root, and they must be writable only by root.
134.Nm
135will refuse to map the sub-tree if the ownership or permissions on
136these files are improper.
137It will also report an error if the count
138of mappings in the first line of the map files is not correct.
139.Sh SEE ALSO
140.Xr mount 8 ,
141.Xr mount_null 8
142.Sh HISTORY
143The
144.Nm
145utility first appeared in
146.Bx 4.4 .
147.Sh BUGS
148The implementation is not very sophisticated.
149