Skip to content

Commit

Permalink
Fix parsing ssh keys as block string
Browse files Browse the repository at this point in the history
  • Loading branch information
blmhemu committed Feb 8, 2024
1 parent 2fe6198 commit 647f61e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lima-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ echo "${LIMA_CIDATA_USER} ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/90-lima-users
# Create authorized_keys
LIMA_CIDATA_SSHDIR="${LIMA_CIDATA_HOMEDIR}"/.ssh
mkdir -p -m 700 "${LIMA_CIDATA_SSHDIR}"
awk '/ssh-authorized-keys/ {flag=1; next} /^ *$/ {flag=0} flag {sub(/^ +- /, ""); gsub("\"", ""); print $0}' \
awk '/ssh-authorized-keys/ {flag=1; next} /^ *$/ {flag=0} flag && $0 !~ /^ +-/ {gsub(/^[ ]+/, ""); print $0}' \
"${LIMA_CIDATA_MNT}"/user-data >"${LIMA_CIDATA_SSHDIR}"/authorized_keys
LIMA_CIDATA_GID=$(id -g "${LIMA_CIDATA_USER}")
chown -R "${LIMA_CIDATA_UID}:${LIMA_CIDATA_GID}" "${LIMA_CIDATA_SSHDIR}"
Expand Down

0 comments on commit 647f61e

Please sign in to comment.