NetBSD/sbin/mount_umap/mount_umap.8
2001-03-06 20:12:33 +00:00

146 lines
5.2 KiB
Groff

.\" $NetBSD: mount_umap.8,v 1.11 2001/03/06 20:12:33 thorpej Exp $
.\"
.\" Copyright (c) 1992, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
.\" All rights reserved.
.\"
.\" This code is derived from software donated to Berkeley by
.\" Jan-Simon Pendry and from John Heidemann of the UCLA Ficus project.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)mount_umap.8 8.4 (Berkeley) 5/1/95
.\"
.Dd March 6, 2001
.Dt MOUNT_UMAP 8
.Os NetBSD
.Sh NAME
.Nm mount_umap
.Nd user and group ID remapping file system layer
.Sh SYNOPSIS
.Nm ""
.Op Fl o Ar options
-u
.Ar uid-mapfile
-g
.Ar gid-mapfile
.Ar target
.Ar mount-point
.Sh DESCRIPTION
The
.Nm
command is used to mount a sub-tree of an existing file system
that uses a different set of uids and gids than the local system.
Such a file system could be mounted from a remote site via NFS,
a local file system on removable media brought from some foreign
location that uses a different user/group database, or could be
a local file system for another operating system which does not
support Unix-style user/group IDs, or which uses a different
numbering scheme.
.Pp
The options are as follows:
.Bl -tag -width indent
.It Fl o
Options are specified with a
.Fl o
flag followed by a comma separated string of options.
See the
.Xr mount 8
man page for possible options and their meanings.
.It Fl g Ar gid-mapfile
Use the group ID mapping specified in
.Ar gid-mapfile .
This flag is required.
.It Fl u Ar uid-mapfile
Use the user ID mapping specified in
.Ar uid-mapfile .
This flag is required.
.El
.Pp
The
.Nm
command uses a set of files provided by the user to make correspondences
between uids and gids in the sub-tree's original environment and
some other set of ids in the local environment. For instance, user
smith might have uid 1000 in the original environment, while having
uid 2000 in the local environment. The
.Nm
command allows the subtree from smith's original environment to be
mapped in such a way that all files with owning uid 1000 look like
they are actually owned by uid 2000.
.Pp
.Em target
should be the current location of the sub-tree in the
local system's name space.
.Em mount-point
should be a directory
where the mapped subtree is to be placed.
.Em uid-mapfile
and
.Em gid-mapfile
describe the mappings to be made between identifiers.
.Pp
The format of the user and group ID mapping files is very simple.
The first line of the file is the total number of mappings present
in the file. The remaining lines each consist of two numbers: the
ID in the mapped subtree and the ID in the original subtree.
.Pp
For example, to map uid 1000 in the original subtree to uid 2000
in the mapped subtree:
.Bd -unfilled -offset indent
1
2000 1000
.Ed
.Pp
For user IDs in the original subtree for which no mapping exists,
the user ID will be mapped to the user
.Dq nobody .
For group IDs in the original subtree for which no mapping exists,
the group ID will be mapped to the group
.Dq nobody .
.Pp
There is a limit of 64 user ID mappings and 16 group ID mappings.
.Pp
The mapfiles can be located anywhere in the file hierarchy, but they
must be owned by root, and they must be writable only by root.
.Nm
will refuse to map the sub-tree if the ownership or permissions on
these files are improper. It will also report an error if the count
of mappings in the first line of the map files is not correct.
.Sh SEE ALSO
.Xr mount 8 ,
.Xr mount_null 8
.Sh BUGS
The implementation is not very sophisticated.
.Sh HISTORY
The
.Nm
utility first appeared in
.Bx 4.4 .