From 765ee33979390a458859896926953902396b86d9 Mon Sep 17 00:00:00 2001 From: Robert Nelson <robertcnelson@gmail.com> Date: Wed, 16 Apr 2014 12:22:52 -0500 Subject: [PATCH] debian: allow option to disable root user Signed-off-by: Robert Nelson <robertcnelson@gmail.com> --- rcn-ee_image.sh | 3 +++ rcn-ee_test_image.sh | 3 +++ scripts/chroot.sh | 17 +++++++++++------ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/rcn-ee_image.sh b/rcn-ee_image.sh index f4dd439d2..de1a29419 100755 --- a/rcn-ee_image.sh +++ b/rcn-ee_image.sh @@ -92,6 +92,8 @@ minimal_armel () { rfs_fullname="${rfs_fullname}" rfs_password="${rfs_password}" + rfs_disable_root="${rfs_disable_root}" + rfs_hostname="${rfs_hostname}" rfs_startup_scripts="${rfs_startup_scripts}" rfs_startup_scripts_rcnee="${rfs_startup_scripts_rcnee}" @@ -270,6 +272,7 @@ is_debian () { rfs_username="debian" rfs_password="temppwd" rfs_fullname="Demo User" + rfs_disable_root="enable" deb_mirror="ftp.us.debian.org/debian/" diff --git a/rcn-ee_test_image.sh b/rcn-ee_test_image.sh index 2ec822f8a..5cb8b1390 100755 --- a/rcn-ee_test_image.sh +++ b/rcn-ee_test_image.sh @@ -86,6 +86,8 @@ minimal_armel () { rfs_fullname="${rfs_fullname}" rfs_password="${rfs_password}" + rfs_disable_root="${rfs_disable_root}" + rfs_hostname="${rfs_hostname}" rfs_startup_scripts="${rfs_startup_scripts}" rfs_startup_scripts_rcnee="${rfs_startup_scripts_rcnee}" @@ -234,6 +236,7 @@ is_debian () { rfs_username="debian" rfs_password="temppwd" rfs_fullname="Demo User" + rfs_disable_root="enable" deb_mirror="ftp.us.debian.org/debian/" diff --git a/scripts/chroot.sh b/scripts/chroot.sh index 9c7839383..185a74259 100755 --- a/scripts/chroot.sh +++ b/scripts/chroot.sh @@ -592,15 +592,20 @@ cat > ${DIR}/chroot_script.sh <<-__EOF__ mkdir -p /home/${rfs_username}/bin chown ${rfs_username}:${rfs_username} /home/${rfs_username}/bin + echo "default username:password is [${rfs_username}:${rfs_password}]" >> /etc/issue + echo "" >> /etc/issue + case "\${deb_distribution}" in Debian) - echo "default username:password is [${rfs_username}:${rfs_password}]" >> /etc/issue - echo "" >> /etc/issue - passwd <<-EOF - root - root - EOF + if [ "x${rfs_disable_root}" = "xenable" ] ; then + passwd -l root || true + else + passwd <<-EOF + root + root + EOF + fi sed -i -e 's:#EXTRA_GROUPS:EXTRA_GROUPS:g' /etc/adduser.conf sed -i -e 's:dialout:dialout i2c spi:g' /etc/adduser.conf -- GitLab