Remove default root user so the default user will become root

Signed-off-by: Dongjin Kim <tobetter@gmail.com>
This commit is contained in:
Dongjin Kim
2021-01-19 17:23:45 +09:00
parent 57aae3aa99
commit 88d71eba5a
4 changed files with 6 additions and 26 deletions

View File

@@ -53,11 +53,6 @@ allow_root_login() {
echo false
}
default_root_passwd() {
[ -z ${DEFAULT_ROOT_PASSWD} ] && DEFAULT_ROOT_PASSWD="odroid"
echo ${DEFAULT_ROOT_PASSWD}
}
default_user() {
[ -z ${DEFAULT_USER} ] && DEFAULT_USER="odroid"
echo ${DEFAULT_USER}
@@ -77,7 +72,6 @@ FLAVOUR=$(default_flavour)
TARGET_DEVICE=$(default_target_device)
DEFAULT_USER=$(default_user)
DEFAULT_PASSWD=$(default_user_passwd)
DEFAULT_ROOT_PASSWD=$(default_root_passwd)
ALLOW_ROOT_LOGIN=$(allow_root_login)
__EOF
}

View File

@@ -1,12 +1,7 @@
#!/bin/sh
if [ "@@ALLOW_ROOT_LOGIN@@" = "true" ]; then
echo "I: set default root password"
echo "root:@@DEFAULT_ROOT_PASSWD@@" | chpasswd
else
if ! adduser @@DEFAULT_USER@@ sudo >/dev/null 2>&1; then
echo "@@DEFAULT_USER@@ ALL=(ALL) ALL" >> /etc/sudoers
fi
if ! adduser @@DEFAULT_USER@@ sudo >/dev/null 2>&1; then
echo "@@DEFAULT_USER@@ ALL=(ALL) ALL" >> /etc/sudoers
fi
echo "I: create default user account"

View File

@@ -204,7 +204,6 @@ do_preinstall() {
-e "s,@@DEFAULT_DEV_BOOT@@,${UUID_BOOT},g" \
-e "s,@@DEFAULT_DEV_ROOTFS@@,${UUID_ROOT},g" \
-e "s,@@ALLOW_ROOT_LOGIN@@,$(allow_root_login),g" \
-e "s,@@DEFAULT_ROOT_PASSWD@@,$(default_root_passwd),g" \
-e "s,@@DEFAULT_USER@@,$(default_user),g" \
-e "s,@@DEFAULT_USER_PASSWD@@,$(default_user_passwd),g" \
-e "s,@@DEFAULT_DISTRO@@,${DISTRO},g" \

16
menu
View File

@@ -96,12 +96,6 @@ do_menu_flavour() {
fi
}
do_menu_root_passwd() {
DEFAULT_ROOT_PASSWD=$(dialog --title "Default root password" --clear \
--inputbox "Enter the password of root" 8 60 \
${DEFAULT_ROOT_PASSWD} 2>&1 >/dev/tty)
}
do_menu_default_user() {
DEFAULT_USER=$(dialog --title "Default user account" --clear \
--inputbox "Enter the default account " 8 60 \
@@ -162,9 +156,8 @@ do_menu() {
1 "Board (${BOARD})" \
2 "Distro (${DISTRO})" \
3 "Flavour (${FLAVOUR})" \
4 "Password of root" \
5 "Default user" \
6 "Password of default user" \
4 "Default user" \
5 "Password of default user" \
2>&1 >/dev/tty)
ret=$?
@@ -179,9 +172,8 @@ do_menu() {
1) do_menu_board "Board";;
2) do_menu_distro "Distro";;
3) do_menu_flavour "Flavour";;
4) do_menu_root_passwd;;
5) do_menu_default_user;;
6) do_menu_default_user_passwd;;
4) do_menu_default_user;;
5) do_menu_default_user_passwd;;
esac
else
clear