mirror of
https://github.com/fire1ce/UDM-Persistent-SSH-Keys.git
synced 2023-10-10 13:36:54 +02:00
initial release
This commit is contained in:
parent
10c03e7f57
commit
b3345f396c
26
.gitignore
vendored
Normal file
26
.gitignore
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
18
99-ssh-keys.sh
Executable file
18
99-ssh-keys.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
user_authorized_keys_file="/mnt/data/ssh/authorized_keys"
|
||||
udm_authorized_keys_file="/root/.ssh/authorized_keys"
|
||||
|
||||
# if /mnt/data/ssh/authorized_keys is missing print error message
|
||||
if [ ! -f "$user_authorized_keys_file" ]; then
|
||||
echo "ERROR: $user_authorized_keys_file is missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Reads the user file line by line and adds the key to the authorized_keys file
|
||||
file=$user_authorized_keys_file
|
||||
while IFS= read -r line || [ -n "$line" ]; do
|
||||
echo $line >>$udm_authorized_keys_file
|
||||
done <"$file"
|
||||
|
||||
exit 0
|
@ -1 +1,6 @@
|
||||
# UDMP-Persistence-SSH-Keys
|
||||
# UDMP Persistence SSH Keys
|
||||
|
||||
## Persistence on Reboot
|
||||
|
||||
The setup script must be run every time the system is rebooted since the __/root/.ssh/authorized_keys__ overwrites every boot.
|
||||
This can be accomplished with a boot script. Flow its guide [UDM / UDMPro Boot Script]([UDM / UDMPro Boot Script](https://github.com/boostchicken-dev/udm-utilities/tree/master/on-boot-script)){target=_blank}
|
15
install.sh
Normal file
15
install.sh
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
user_authorized_keys_file="/mnt/data/ssh/authorized_keys"
|
||||
|
||||
curl -O https://raw.githubusercontent.com/fire1ce/
|
||||
mv 99-ssh-keys.sh /mnt/data/on_boot.d/99-ssh-keys.sh
|
||||
chmod +x /mnt/data/on_boot.d/99-ssh-keys.sh
|
||||
|
||||
if [ ! -f "$user_authorized_keys_file" ]; then
|
||||
touch $user_authorized_keys_file
|
||||
fi
|
||||
|
||||
chmod 0644 $user_authorized_keys_file
|
||||
|
||||
exit 0
|
Loading…
x
Reference in New Issue
Block a user