[lxc-devel] [PATCH 3/4] change root passwd for debian template

Daniel Lezcano dlezcano at fr.ibm.com
Tue Jun 1 16:57:47 UTC 2010


From: Daniel Lezcano <daniel.lezcano at free.fr>

Change default root password to 'root' and generate locales
automatically

Signed-off-by: Daniel Lezcano <dlezcano at fr.ibm.com>
---
 scripts/lxc-busybox.in |   10 +++-------
 scripts/lxc-debian.in  |   30 ++++++------------------------
 2 files changed, 9 insertions(+), 31 deletions(-)

diff --git a/scripts/lxc-busybox.in b/scripts/lxc-busybox.in
index 1d4009d..40542d5 100644
--- a/scripts/lxc-busybox.in
+++ b/scripts/lxc-busybox.in
@@ -74,13 +74,6 @@ EOF
 root:x:0:root
 EOF
 
-    # empty password
-    cat <<EOF >> $rootfs/etc/shadow
-root:\$1\$NJJLsV0P\$Y/esfSXDNR88G/bZFzgWY1:14595:0:99999:7:::
-EOF
-
-    echo "empty password for root, don't forget to change it !"
-
     # mount everything
     cat <<EOF >> $rootfs/etc/init.d/rcS
 #!/bin/sh
@@ -214,6 +207,9 @@ configure_busybox()
     # passwd exec must be setuid
     chmod +s $rootfs/bin/passwd
 
+    echo "root:root" | chroot $rootfs chpasswd
+    echo "Root password is 'root', please change !"
+
     return 0
 }
 
diff --git a/scripts/lxc-debian.in b/scripts/lxc-debian.in
index 6ee511d..d940b7f 100755
--- a/scripts/lxc-debian.in
+++ b/scripts/lxc-debian.in
@@ -49,29 +49,6 @@ EOF
     mkdir -p $rootfs/selinux
     echo 0 > $rootfs/selinux/enforce
 
-    # by default setup root password with no password
-    cat <<EOF > $rootfs/etc/ssh/sshd_config
-Port 22
-Protocol 2
-HostKey /etc/ssh/ssh_host_rsa_key
-HostKey /etc/ssh/ssh_host_dsa_key
-UsePrivilegeSeparation yes
-KeyRegenerationInterval 3600
-ServerKeyBits 768
-SyslogFacility AUTH
-LogLevel INFO
-LoginGraceTime 120
-PermitRootLogin yes
-StrictModes yes
-RSAAuthentication yes
-PubkeyAuthentication yes
-IgnoreRhosts yes
-RhostsRSAAuthentication no
-HostbasedAuthentication no
-PermitEmptyPasswords yes
-ChallengeResponseAuthentication no
-EOF
-
     # configure the network using the dhcp
     cat <<EOF > $rootfs/etc/network/interfaces
 auto lo
@@ -87,12 +64,17 @@ $hostname
 EOF
 
     # reconfigure some services
-    chroot $rootfs /usr/sbin/dpkg-reconfigure locales
+    chroot $rootfs locale-gen en_US.UTF-8
 
     # remove pointless services in a container
     chroot $rootfs /usr/sbin/update-rc.d -f umountfs remove
     chroot $rootfs /usr/sbin/update-rc.d -f hwclock.sh remove
     chroot $rootfs /usr/sbin/update-rc.d -f hwclockfirst.sh remove
+
+    echo "root:root" | chroot $rootfs chpasswd
+    echo "Root password is 'root', please change !"
+
+    return 0
 }
 
 download_debian()
-- 
1.7.0.4





More information about the lxc-devel mailing list