summaryrefslogtreecommitdiff
path: root/bin/debvm-create
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2024-08-13 10:18:24 +0200
committerHelmut Grohne <helmut@subdivi.de>2024-08-13 10:18:24 +0200
commitf35ef9a20fabfd6e57db83136dc4486fe7757bdc (patch)
tree3d92baf3aec9bc15b33e93a8bfeeed8cdfe4a20a /bin/debvm-create
parent984a1155456df7bbda7e2f7c1d6bcedff68f609e (diff)
downloaddebvm-f35ef9a20fabfd6e57db83136dc4486fe7757bdc.tar.gz
debvm-create: implement password deletion with correctly quoted sed
While using the --prefix option is great, it's only available in trixie. Hence, revert back to sed, this time getting the quoting right (by avoiding backslashes using character sequences) and also apply to all lines of the file as systemd seems to be adding users to the front. Reported-by: Vasyl Vavrychuk Fixes: 984a1155456d ("debvm-create: revert back to passwd for deleting the root password") Closes: #17
Diffstat (limited to 'bin/debvm-create')
-rwxr-xr-xbin/debvm-create5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/debvm-create b/bin/debvm-create
index c9837e8..9ab2472 100755
--- a/bin/debvm-create
+++ b/bin/debvm-create
@@ -356,7 +356,10 @@ set -- \
"$@"
# allow password-less root login
-set -- '--customize-hook=passwd --prefix "$1" --delete root' "$@"
+# In future, we should use passwd --prefix "$1" --delete root here, but the
+# --prefix option was added in trixie and the --root option uses chroot() and
+# attempts to load shared libraries from a potentially foreign chroot.
+set -- '--customize-hook=sed -i -e "s/^root:[*]:/root::/" "$1/etc/shadow"' "$@"
if test "$INITSYSTEM" = systemd && ! check_skip systemdnetwork; then
# dhcp on all network interfaces, and add a dns resolver