We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4a7bb29 commit 465c349Copy full SHA for 465c349
1 file changed
demos/userns-block-fd.sh
@@ -0,0 +1,25 @@
1
+#!/usr/bin/env bash
2
+# This is an example of using the userns-block feature with bash.
3
+
4
+# info pipe
5
+exec 10<> <(:)
6
+# userns_block pipe
7
+exec 11<> <(:)
8
9
+userns_setup() {
10
+ child_pid=$(jq -rn 'input | .["child-pid"]' <&10)
11
+ newuidmap $child_pid 0 $(id -u) 1
12
+ newgidmap $child_pid 0 $(id -g) 1
13
+ echo 1 >&11
14
+ exec 11>&-
15
+}
16
+userns_setup 10<&10 11>&11 &
17
18
+bwrap \
19
+ --unshare-all \
20
+ --unshare-user \
21
+ --userns-block-fd 11 \
22
+ --info-fd 10 \
23
+ --bind / / \
24
+ cat /proc/self/uid_map \
25
+ 10>&10 11<&11
0 commit comments