diff --git a/RESOURCES/KEYS/authorized_keys b/RESOURCES/KEYS/authorized_keys new file mode 100644 index 0000000..13e0f44 --- /dev/null +++ b/RESOURCES/KEYS/authorized_keys @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDSgUO8lOHu3MXAjLgF7WIt6a5ZsU+HWE7MOuHb0tJG7T62GkoR1PSRRKGCCcsxdAR8PshkpkeEODHQJYzpMHJIY7SbtmwC5qJCE8iMuaA+PcJzBvTdGfmF/jBqfwvntY4EEZn4kF8ZImr4vHAWojJkOrAwwtLBG/VWawPNfZLxXGjnizNaWclYEzi7PXlIfON0gDrFvOZal07IQy+RGWz0BYUxCDWYYVZ3/IStWr3OTJdZeXVu8UoH5q9nhbmSGFACMqjcUtJ8weUBZZgOebDI2ALnFzejKQuJmjIo/aQBTe7FERB78P2AA79tO1quyeCkEmq0awNVCXvhracBnC+DnrbNUDwYpOWDZeeRHPjbCRkC55QQN3a6nLrJ949DAtb7+Yxy4NhiXksmCR8vUzeiM+Hwx7iF7ynho4pCnodqX5W3CyqvARGSJTrT4oqL+48xBZkM/N/134SfJiFALgkb5NUwC3A06L5UmumJrUVb1pMQPyO5L/vFffFaYeuS/I0= diff --git a/RESOURCES/OPTIONS/authorized_keys/authorized_keys.sh b/RESOURCES/OPTIONS/authorized_keys/authorized_keys.sh new file mode 100755 index 0000000..f7aba29 --- /dev/null +++ b/RESOURCES/OPTIONS/authorized_keys/authorized_keys.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# check the parameters +if [ $# != 2 ]; then + echo "usage : $0 " + exit 1 +fi + +project_root="$1" +authorized_keys="$2" + +# check the project root folder +if [ ! -d "$project_root" ]; then + echo -e "${RED}ERROR: Cannot find the folder '$project_root' ${NC}" + exit 2 +fi + +# check the authorized_keys file +if [ ! -f "$authorized_keys" ]; then + echo -e "${RED}ERROR: Cannot find the file '$authorized_keys' ${NC}" + exit 3 +fi + +# check the target folder +target_folder="$ROOTFS_DIR/opt/etc/dropbear" +if [ ! -d "$target_folder" ]; then + echo -e "${RED}ERROR: Cannot find the output folder '$target_folder' ${NC}" + exit 4 +fi + +# enable remote ssh access by keys instead of a password +cp "$authorized_keys" "$target_folder/authorized_keys" +chmod 600 "$target_folder/authorized_keys" + +echo -e "${GREEN}SUCCESS: The authorized_keys file has been copied to the target folder ${NC}" + +exit 0 diff --git a/options.cfg b/options.cfg index 442ed2c..721b80a 100644 --- a/options.cfg +++ b/options.cfg @@ -36,6 +36,10 @@ opkg="default" # Enable the SSH server, use 'dropbear' type ssh (recommended) ssh="dropbear" +# Set the authorized keys file for the ssh remote access with keys (instead of a password) +# Provide the file with your public key(s). You must have the private key set in your ssh client +authorized_keys="@/RESOURCES/KEYS/authorized_keys" [ssh] + # Enable a web server # Use "webfs-v1" with default port 8000 or "webfs-v1:port" for a custom port # Browse http://printer_ip:8000/mesh for the 3D auto bed leveling mesh visualizer