]> git.ipfire.org Git - thirdparty/util-linux.git/commit
unshare: allow persisting namespaces
authorKarel Zak <kzak@redhat.com>
Thu, 9 Apr 2015 09:34:02 +0000 (11:34 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 14 Apr 2015 09:39:15 +0000 (11:39 +0200)
commit0490a6ca26f6e7bf9eed5521d240661adb302ba2
tree0788a179e43144219d9226badd190b1a77f6e713
parentd1f9c0969eb24d0a5ec5d862bd41b1bd5f3103f0
unshare: allow persisting namespaces

For nsenter(1) we already support namespace specification by file
(e.g. bind mount to namespace /proc/[pid]/ns/[type] file). For
example:

  # nsenter --uts=/some/path

This patch extends unshare(1) to setup the bind mount for specified
namespace, for example

  # touch /some/path
  # unshare --uts=/some/path hostname FOO
  # nsenter --uts=/some/path hostname
  FOO

Note that the problem is mount namespace, because create bind mount
to ns/mount file within unshared namespace does not make sense.

Based on patch from Lubomir Rintel <lkundrak@v3.sk>.

Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/unshare.1
sys-utils/unshare.c