Added option authorized_keys
This commit is contained in:
parent
a463774554
commit
fc87b1fa10
3 changed files with 42 additions and 0 deletions
1
RESOURCES/KEYS/authorized_keys
Normal file
1
RESOURCES/KEYS/authorized_keys
Normal file
|
|
@ -0,0 +1 @@
|
|||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDSgUO8lOHu3MXAjLgF7WIt6a5ZsU+HWE7MOuHb0tJG7T62GkoR1PSRRKGCCcsxdAR8PshkpkeEODHQJYzpMHJIY7SbtmwC5qJCE8iMuaA+PcJzBvTdGfmF/jBqfwvntY4EEZn4kF8ZImr4vHAWojJkOrAwwtLBG/VWawPNfZLxXGjnizNaWclYEzi7PXlIfON0gDrFvOZal07IQy+RGWz0BYUxCDWYYVZ3/IStWr3OTJdZeXVu8UoH5q9nhbmSGFACMqjcUtJ8weUBZZgOebDI2ALnFzejKQuJmjIo/aQBTe7FERB78P2AA79tO1quyeCkEmq0awNVCXvhracBnC+DnrbNUDwYpOWDZeeRHPjbCRkC55QQN3a6nLrJ949DAtb7+Yxy4NhiXksmCR8vUzeiM+Hwx7iF7ynho4pCnodqX5W3CyqvARGSJTrT4oqL+48xBZkM/N/134SfJiFALgkb5NUwC3A06L5UmumJrUVb1pMQPyO5L/vFffFaYeuS/I0=
|
||||
37
RESOURCES/OPTIONS/authorized_keys/authorized_keys.sh
Executable file
37
RESOURCES/OPTIONS/authorized_keys/authorized_keys.sh
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
|
||||
# check the parameters
|
||||
if [ $# != 2 ]; then
|
||||
echo "usage : $0 <project_root> <authorized_keys>"
|
||||
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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue