From 96bd45c823a8b8aaf1d684ccc8ad063ac411a0f4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Graber?= Date: Tue, 31 Jul 2012 16:01:28 +0200 Subject: [PATCH] ubuntu template: add sudo group and cleanup minor devttydir issue Always add the user to the 'sudo' group as it's been around since at least Ubuntu 10.04. In addition make the user part of the admin group until 12.04 where it's been removed. Also fix a minor layout issue with devttydir. Signed-off-by: Serge Hallyn Signed-off-by: Daniel Lezcano --- templates/lxc-ubuntu.in | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in index f31bc789c..d959ccb49 100644 --- a/templates/lxc-ubuntu.in +++ b/templates/lxc-ubuntu.in @@ -55,9 +55,9 @@ EOF EOF if [ "$release" = "precise" ]; then - group="sudo" + groups="sudo" else - group="admin" + groups="sudo admin" # suppress log level output for udev sed -i "s/=\"err\"/=0/" $rootfs/etc/udev/udev.conf @@ -67,9 +67,14 @@ EOF rm -f $rootfs/etc/init/tty{5,6}.conf fi - chroot $rootfs groupadd --system $group >/dev/null 2>&1 || true - chroot $rootfs useradd --create-home -s /bin/bash -G $group ubuntu + chroot $rootfs useradd --create-home -s /bin/bash ubuntu echo "ubuntu:ubuntu" | chroot $rootfs chpasswd + + for group in $groups; do + chroot $rootfs groupadd --system $group >/dev/null 2>&1 || true + chroot $rootfs adduser ubuntu $group >/dev/null 2>&1 || true + done + if [ -n "$auth_key" -a -f "$auth_key" ]; then u_path="/home/ubuntu/.ssh" root_u_path="$rootfs/$u_path" @@ -307,7 +312,7 @@ EOF cat <> $path/config lxc.utsname = $name -lxc.devttydir = $ttydir +lxc.devttydir =$ttydir lxc.tty = 4 lxc.pts = 1024 lxc.rootfs = $rootfs -- 2.47.2