Template name: Debian 13 (stock) with SSH key
Description: Sets up a normal Debian 13 install, but also installs your provided key to make it easy to log in.
Base OS image: Debian_13_Trixie_x64
Memory needed: 1
Cores minimum: 1
Input #1 label: Your SSH authorized_key entry
Input #1 tooltip: This must be a single line that starts with ssh-rsa, ssh-ecdsa, or ssh-ed25519 (ed25519 is recommended), as output by an OpenSSH or PuTTy key generator. It will be added to /root/.ssh/authorized_keys to allow easy root login. For instance, ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINIaE1vMrxY9jKRRisaZm44vPIRlSRuw9vuub2SerAPk root@you
Input #1 regex: ^ssh-(ed25519|rsa|ecdsa-sha2-nistp\d\d\d) AAAA(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})( [^@\n]+@[^@\n]+)?$
The script:
Code: Select all
#!/bin/bash
INPUT1=${input_1}
mkdir /root/.ssh
echo $INPUT1 > /root/.ssh/authorized_keys
chmod 0700 /root/.ssh
chmod 0600 /root/.ssh/authorized_keys
grep "ssh-rsa" <<< "$INPUT1" && echo "PubkeyAcceptedKeyTypes=+ssh-rsa" >> /etc/ssh/sshd_config
service ssh restart