ensure paths exists before writing keys

Ensure the target path exists before writing the keys so there's no errors for the user. Dropped a temp variable as well.
This commit is contained in:
Doug Goldstein 2023-02-26 11:46:54 -06:00 committed by GitHub
parent 05d9413601
commit 7d6d086ff3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,9 +28,9 @@ if [ ! -f "$user_authorized_keys_file" ]; then
fi
# Reads the user file line by line and adds the key to the authorized_keys file
file=$user_authorized_keys_file
mkdir -p "$(dirname ${udm_authorized_keys_file})"
while IFS= read -r line || [ -n "$line" ]; do
echo $line >>$udm_authorized_keys_file
done <"$file"
done <"$user_authorized_keys_file"
exit 0