xref: /netbsd/sbin/mount_umap/mount_umap.8 (revision bf9ec67e)
1.\"	$NetBSD: mount_umap.8,v 1.14 2001/11/16 11:21:38 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.  For instance, user
91smith might have uid 1000 in the original environment, while having
92uid 2000 in the local environment.  The
93.Nm
94command allows the subtree from smith's original environment to be
95mapped in such a way that all files with owning uid 1000 look like
96they are actually owned by uid 2000.
97.Pp
98.Em target
99should be the current location of the sub-tree in the
100local system's name space.
101.Em mount-point
102should be a directory
103where the mapped subtree is to be placed.
104.Em uid-mapfile
105and
106.Em gid-mapfile
107describe the mappings to be made between identifiers.
108.Pp
109The format of the user and group ID mapping files is very simple.
110The first line of the file is the total number of mappings present
111in the file.  The remaining lines each consist of two numbers: the
112ID in the mapped subtree and the ID in the original subtree.
113.Pp
114For example, to map uid 1000 in the original subtree to uid 2000
115in the mapped subtree:
116.Bd -unfilled -offset indent
1171
1182000 1000
119.Ed
120.Pp
121For user IDs in the original subtree for which no mapping exists,
122the user ID will be mapped to the user
123.Dq nobody .
124For group IDs in the original subtree for which no mapping exists,
125the group ID will be mapped to the group
126.Dq nobody .
127.Pp
128There is a limit of 64 user ID mappings and 16 group ID mappings.
129.Pp
130The mapfiles can be located anywhere in the file hierarchy, but they
131must be owned by root, and they must be writable only by root.
132.Nm
133will refuse to map the sub-tree if the ownership or permissions on
134these files are improper.  It will also report an error if the count
135of mappings in the first line of the map files is not correct.
136.Sh SEE ALSO
137.Xr mount 8 ,
138.Xr mount_null 8
139.Sh HISTORY
140The
141.Nm
142utility first appeared in
143.Bx 4.4 .
144.Sh BUGS
145The implementation is not very sophisticated.
146