hacks/fix-raspian-defaults/root.overlay/boot/per-once.d/98-setup-ssh-keys.sh

22 lines
522 B
Bash
Raw Normal View History

2019-10-04 12:55:40 +00:00
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
apt update && apt install -y curl
KEY_URL="https://sneak.cloud/authorized_keys"
2019-10-04 15:10:07 +00:00
# CAUTION! /!\
# doing only passwd -d <user> means they can log in at the console
# with no password whatsoever - probably not what you want
2019-10-04 12:55:40 +00:00
curl -fLo /root/.ssh/authorized_keys --create-dirs $KEY_URL && \
2019-10-04 15:10:07 +00:00
passwd -d root && \
passwd -l root
2019-10-04 12:55:40 +00:00
curl -fLo /home/pi/.ssh/authorized_keys --create-dirs $KEY_URL && \
2019-10-04 15:10:07 +00:00
passwd -d pi && \
passwd -l pi
2019-10-04 12:55:40 +00:00
chown -R pi:pi /home/pi/.ssh