From 11beac0694475b6c51e55d0711e9d3f26509d2b8 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 14 Jan 2022 21:13:28 +0100 Subject: sbin/itzks-update-disklserver-squashfs-images: Make sure /root.ssh/ folder exists before trying to copy something inside. --- sbin/itzks-update-disklserver-squashfs-images | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sbin/itzks-update-disklserver-squashfs-images b/sbin/itzks-update-disklserver-squashfs-images index ef34f37..e9906c6 100755 --- a/sbin/itzks-update-disklserver-squashfs-images +++ b/sbin/itzks-update-disklserver-squashfs-images @@ -129,8 +129,10 @@ for chroot in ${ltsp_chroots}; do for priv_key_file in id_ecdsa id_ecdsa_sk id_ed25519 id_ed25519_sk id_rsa; do if [ -e "/root/.ssh/${priv_key_file}.DLW" ] && [ ! -e "${LTSP_OPT}/${chroot}/root/.ssh/${priv_key_file}" ]; then + mkdir -p "${LTSP_OPT}/${chroot}/root/.ssh/" cp "/root/.ssh/${priv_key_file}.DLW" "${LTSP_OPT}/${chroot}/root/.ssh/${priv_key_file}" elif [ -e "/root/.ssh/${priv_key_file}" ] && [ ! -e "${LTSP_OPT}/${chroot}/root/.ssh/${priv_key_file}" ]; then + mkdir -p "${LTSP_OPT}/${chroot}/root/.ssh/" cp "/root/.ssh/${priv_key_file}" "${LTSP_OPT}/${chroot}/root/.ssh/${priv_key_file}" fi @@ -139,6 +141,7 @@ for chroot in ${ltsp_chroots}; do # Copy the SSH authorized_keys file for DLWs to ${LTSP_OPT}/${chroot}/root/.ssh/authorized_keys (e.g. disklserver:/root/.ssh/authorized_keys) # Use host's authorized_keys file for granting DLW access via SSH as root without password if [ -e "/root/.ssh/authorized_keys" ] && [ ! -e "${LTSP_OPT}/${chroot}/root/.ssh/authorized_keys" ]; then + mkdir -p "${LTSP_OPT}/${chroot}/root/.ssh/" cp "/root/.ssh/authorized_keys" "${LTSP_OPT}/${chroot}/root/.ssh/authorized_keys" fi -- cgit v1.2.3