Skip to content

Commit c370bfe

Browse files
committed
Look for ssh_authorized_keys without dashes
The documented spelling of ssh-authorized-keys is actually invalid according to jsonschema, even if accepted by python. Signed-off-by: Anders F Björklund <[email protected]>
1 parent 5a09f68 commit c370bfe

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lima-init.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ echo "${LIMA_CIDATA_USER} ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/90-lima-users
3939
# Create authorized_keys
4040
LIMA_CIDATA_SSHDIR="${LIMA_CIDATA_HOMEDIR}"/.ssh
4141
mkdir -p -m 700 "${LIMA_CIDATA_SSHDIR}"
42-
awk '/ssh-authorized-keys/ {flag=1; next} /^ *$/ {flag=0} flag {sub(/^ +- /, ""); gsub(/^"|"$/,""); gsub("\\\\\"", "\""); print $0}' \
42+
# Lima currently uses "ssh-authorized-keys", which is invalid and should be "ssh_authorized_keys"
43+
awk '/ssh[-_]authorized[-_]keys/ {flag=1; next} /^ *$/ {flag=0} flag {sub(/^ +- /, ""); gsub(/^"|"$/,""); gsub("\\\\\"", "\""); print $0}' \
4344
"${LIMA_CIDATA_MNT}"/user-data >"${LIMA_CIDATA_SSHDIR}"/authorized_keys
4445
LIMA_CIDATA_GID=$(id -g "${LIMA_CIDATA_USER}")
4546
chown -R "${LIMA_CIDATA_UID}:${LIMA_CIDATA_GID}" "${LIMA_CIDATA_SSHDIR}"

0 commit comments

Comments
 (0)