Is there a way to pre-load ~pi/.ssh/authorized_keys with an SSH key or two prior to first boot? If so, how?
If not, it would make sense (to me) that if I were to put an SSH key in the ssh file that it would be copied automatically to ~pi/.ssh/authorized_keys and then possibly PasswordAuthentication set to "no" in /etc/ssh/sshd_config
The following script would do that if run before the ssh file is removed. How should I go about requesting adding this to the Raspbian image?
Code: Select all
#!/bin/sh set -e; PATH=/usr/sbin:/usr/bin:/sbin:/bin; ssh-keygen -q -l -f /boot/ssh > /dev/null 2>&1; mkdir -p -m 700 /home/pi/.ssh/ cp /boot/ssh /home/.ssh/authorized_keys; chmod 640 /home/.ssh/authorized_keys; chown -R pi:pi /home/pi/; sed -i.orig '/^#PasswordAuthentication yes/cPasswordAuthentication no' /etc/ssh/sshd_config exit 0;