From f35ef9a20fabfd6e57db83136dc4486fe7757bdc Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Tue, 13 Aug 2024 10:18:24 +0200 Subject: 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 --- bin/debvm-create | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'bin/debvm-create') 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 -- cgit v1.2.3