ganeti-ansible/roles/node/files/ganeti/instance-debootstrap/hooks/clear-root-password

22 lines
560 B
Plaintext
Raw Permalink Normal View History

2025-02-25 15:57:40 +00:00
#!/bin/sh
set -e
# Make sure we're not working on the root directory
if [ -z "$TARGET" -o "$TARGET" = "/" ]; then
echo "Invalid target directory '$TARGET', aborting." 1>&2
exit 1
fi
if [ "$(mountpoint -d /)" = "$(mountpoint -d "$TARGET")" ]; then
echo "The target directory seems to be the root dir, aborting." 1>&2
exit 1
fi
# Disable root's password, as the switch to enable shadow by default
# has left root with a disabled password, preventing the initial login
echo "Disabling root's password"
chroot "$TARGET" passwd -d root
exit 0