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
# 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
}
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
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()