1podman-unshare(1)() podman-unshare(1)()
2
3
4
6 podman-unshare - Run a command inside of a modified user namespace
7
8
10 podman unshare [--] [command]
11
12
14 Launches a process (by default, $SHELL) in a new user namespace. The
15 user namespace is configured so that the invoking user's UID and pri‐
16 mary GID appear to be UID 0 and GID 0, respectively. Any ranges which
17 match that user and group in /etc/subuid and /etc/subgid are also
18 mapped in as themselves with the help of the newuidmap(1) and
19 newgidmap(1) helpers.
20
21
22 podman unshare is useful for troubleshooting unprivileged operations
23 and for manually clearing storage and other data related to images and
24 containers.
25
26
27 It is also useful if you want to use the podman mount command. If an
28 unprivileged user wants to mount and work with a container, then they
29 need to execute podman unshare. Executing podman mount fails for un‐
30 privileged users unless the user is running inside a podman unshare
31 session.
32
33
34 The unshare session defines two environment variables:
35
36
37 • CONTAINERS_GRAPHROOT: the path to the persistent container's
38 data.
39
40 • CONTAINERS_RUNROOT: the path to the volatile container's data.
41
42
43
45 --help, -h
46 Print usage statement
47
48
49 --rootless-cni
50 Join the rootless network namespace used for CNI networking. It can be
51 used to connect to a rootless container via IP address (CNI network‐
52 ing). This is otherwise not possible from the host network namespace.
53 Note: Using this option with more than one unshare session can have un‐
54 expected results.
55
56
58 $ podman unshare id
59 uid=0(root) gid=0(root) groups=0(root),65534(nobody)
60
61 $ podman unshare cat /proc/self/uid_map /proc/self/gid_map
62 0 1000 1
63 1 10000 65536
64 0 1000 1
65 1 10000 65536
66
67 $ podman unshare --rootless-cni ip addr
68 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
69 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
70 inet 127.0.0.1/8 scope host lo
71 valid_lft forever preferred_lft forever
72 inet6 ::1/128 scope host
73 valid_lft forever preferred_lft forever
74 2: tap0: <BROADCAST,UP,LOWER_UP> mtu 65520 qdisc fq_codel state UNKNOWN group default qlen 1000
75 link/ether 36:0e:4a:c7:45:7e brd ff:ff:ff:ff:ff:ff
76 inet 10.0.2.100/24 brd 10.0.2.255 scope global tap0
77 valid_lft forever preferred_lft forever
78 inet6 fe80::340e:4aff:fec7:457e/64 scope link
79 valid_lft forever preferred_lft forever
80 3: cni-podman2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
81 link/ether 5e:3a:71:d2:b4:3a brd ff:ff:ff:ff:ff:ff
82 inet 10.89.1.1/24 brd 10.89.1.255 scope global cni-podman2
83 valid_lft forever preferred_lft forever
84 inet6 fe80::5c3a:71ff:fed2:b43a/64 scope link
85 valid_lft forever preferred_lft forever
86 4: vethd4ba3a2f@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master cni-podman2 state UP group default
87 link/ether 8a:c9:56:32:17:0c brd ff:ff:ff:ff:ff:ff link-netnsid 0
88 inet6 fe80::88c9:56ff:fe32:170c/64 scope link
89 valid_lft forever preferred_lft forever
90
91
92
94 podman(1), podman-mount(1), namespaces(7), newuidmap(1), newgidmap(1),
95 user_namespaces(7)
96
97
98
99 podman-unshare(1)()