Update chroot_setup.sh
This commit is contained in:
parent
934d9f8061
commit
0ebb2e330e
@ -20,10 +20,21 @@ cat <<EOF >/etc/hosts
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
echo ">>> Creating users"
|
echo ">>> Creating users"
|
||||||
|
|
||||||
|
# Root password
|
||||||
echo "root:${ROOT_PASSWORD}" | chpasswd
|
echo "root:${ROOT_PASSWORD}" | chpasswd
|
||||||
useradd -m -G wheel -s /bin/bash "${USERNAME}"
|
|
||||||
|
# Create user only if missing
|
||||||
|
if ! id -u "${USERNAME}" &>/dev/null; then
|
||||||
|
useradd -m -G wheel -s /bin/bash "${USERNAME}"
|
||||||
|
else
|
||||||
|
echo "User ${USERNAME} already exists, skipping creation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Always (re)set password
|
||||||
echo "${USERNAME}:${USER_PASSWORD}" | chpasswd
|
echo "${USERNAME}:${USER_PASSWORD}" | chpasswd
|
||||||
|
|
||||||
|
# Ensure sudoers configuration exists
|
||||||
mkdir -p /etc/sudoers.d
|
mkdir -p /etc/sudoers.d
|
||||||
echo "%wheel ALL=(ALL:ALL) ALL" > /etc/sudoers.d/10-wheel
|
echo "%wheel ALL=(ALL:ALL) ALL" > /etc/sudoers.d/10-wheel
|
||||||
chmod 440 /etc/sudoers.d/10-wheel
|
chmod 440 /etc/sudoers.d/10-wheel
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user