[lxc-devel] [PATCH 1/8] templates: require running as root
Serge Hallyn
serge at mail.hallyn.com
Fri Jul 19 14:26:48 UTC 2013
From: Serge Hallyn <serge.hallyn at ubuntu.com>
Up to now lxc-create ensured that you were running as root. Now the
templates which require root need to do it for themselves. Templates
which do mknod definately require root.
Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
templates/lxc-alpine.in | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in
index be2a535..ce7226f 100644
--- a/templates/lxc-alpine.in
+++ b/templates/lxc-alpine.in
@@ -250,6 +250,12 @@ default_path=@LXCPATH@
release=
arch=$(uname -m)
+# template mknods, requires root
+if [ $(id -u) -ne 0 ]; then
+ echo "$(basename $0): must be run as root" >&2
+ exit 1
+fi
+
while [ $# -gt 0 ]; do
opt="$1"
shift
--
1.8.3.2
More information about the lxc-devel
mailing list