From 36eef1bb1446f777beb961d00100610647a5b886 Mon Sep 17 00:00:00 2001 From: Aleksandr Berkuta Date: Fri, 30 May 2025 16:30:32 +0300 Subject: [PATCH] Add passwd parameter to user-data --- lib/tiny-cloud/user-data/cloud-config | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/tiny-cloud/user-data/cloud-config b/lib/tiny-cloud/user-data/cloud-config index c363056..ab09880 100644 --- a/lib/tiny-cloud/user-data/cloud-config +++ b/lib/tiny-cloud/user-data/cloud-config @@ -244,7 +244,7 @@ in_list() { init__userdata_users() { local i users="$(get_userdata users)" for i in $users; do - local name="" gecos="" homedir="" shell="" primary_group="" groups="" + local name="" gecos="" homedir="" shell="" primary_group="" groups="" passwd="" hashed_passwd="" local system=false no_create_home=false lock_passwd=true local keys="$(get_userdata users/$i)" if [ "$i" = 1 ] && [ "$keys" = "default" ]; then @@ -273,6 +273,10 @@ init__userdata_users() { if in_list no_create_home $keys; then no_create_home="$(get_userdata users/$i/no_create_home)" fi + if in_list passwd $keys; then + passwd="$(get_userdata users/$i/passwd)" + echo "${user}:${passwd}" | $MOCK chpasswd -e + fi if getent passwd "$user" >/dev/null; then log -i -t "$phase" info "$ACTION: user $user already exists"