summaryrefslogtreecommitdiff
path: root/stage2
diff options
context:
space:
mode:
authorSerge Schneider <serge@raspberrypi.com>2020-09-09 15:12:53 +0100
committerSerge Schneider <serge@raspberrypi.com>2020-09-09 15:12:53 +0100
commitbc3970f9e397c495177ff346b1f359d51bc79540 (patch)
treea72b3e4b7058d0ebd3caad7f3913ff777668bbe4 /stage2
parentd3553f5ec44b01842fcfee8ea99392ee22bdefdf (diff)
parentc1a7dae113ce943abe8bf5d5ab36fb7aac829fd2 (diff)
Merge branch 'master' into arm64
Diffstat (limited to 'stage2')
-rwxr-xr-xstage2/01-sys-tweaks/01-run.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/stage2/01-sys-tweaks/01-run.sh b/stage2/01-sys-tweaks/01-run.sh
index 8d28adc..c1836f9 100755
--- a/stage2/01-sys-tweaks/01-run.sh
+++ b/stage2/01-sys-tweaks/01-run.sh
@@ -11,6 +11,18 @@ install -m 644 files/console-setup "${ROOTFS_DIR}/etc/default/"
install -m 755 files/rc.local "${ROOTFS_DIR}/etc/"
+if [ -n "${PUBKEY_SSH_FIRST_USER}" ]; then
+ install -v -m 0700 -o 1000 -g 1000 -d "${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh
+ echo "${PUBKEY_SSH_FIRST_USER}" >"${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh/authorized_keys
+ chown 1000:1000 "${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh/authorized_keys
+ chmod 0600 "${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh/authorized_keys
+fi
+
+if [ "${PUBKEY_ONLY_SSH}" = "1" ]; then
+ sed -i -Ee 's/^#?[[:blank:]]*PubkeyAuthentication[[:blank:]]*no[[:blank:]]*$/PubkeyAuthentication yes/
+s/^#?[[:blank:]]*PasswordAuthentication[[:blank:]]*yes[[:blank:]]*$/PasswordAuthentication no/' "${ROOTFS_DIR}"/etc/ssh/sshd_config
+fi
+
on_chroot << EOF
systemctl disable hwclock.sh
systemctl disable nfs-common