]> git.ipfire.org Git - thirdparty/util-linux.git/commit - sys-utils/unshare.1
unshare: Add possibility to add mapping into root user in user namespace
authorLubomir Rintel <lkundrak@v3.sk>
Fri, 27 Dec 2013 21:14:48 +0000 (22:14 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 7 Jan 2014 10:04:42 +0000 (11:04 +0100)
commit4da21e374e34350941d54f7b0fe33a06d92e9eaa
treef21cdca14733c9c17c222c0b8b5f3f3129c7baa4
parentcad44d02bd8ac0c36d50f53ac9f335520aa2e247
unshare: Add possibility to add mapping into root user in user namespace

This makes it very convenient to use make use of privileged actions
on CONFIG_USER_NS enabled kernels, without having to manually tinker
with uid_map and gid_map to obtain required credentials (as those
given upon unshare() vanish with call to execve() and lot of userspace
checks for euid==0 anyway).

Usage example:

$ unshare --uts
unshare: unshare failed: Operation not permitted

$ unshare --user --uts
[nfsnobody@odvarok ~]$ hostname swag
hostname: you must be root to change the host name

$ unshare -r --uts
[root@odvarok util-linux]# hostname swag
[root@odvarok util-linux]#

[kzak@redhat.com: - move code to map_id()
                  - use all-io.h
                  - add paths to pathnames.h]

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Karel Zak <kzak@redhat.com>
include/pathnames.h
sys-utils/unshare.1
sys-utils/unshare.c