mirror of
https://github.com/fire1ce/UDM-Persistent-SSH-Keys.git
synced 2023-10-10 13:36:54 +02:00
20230227.1316
This commit is contained in:
parent
05d9413601
commit
100c4460a0
@ -3,20 +3,20 @@
|
|||||||
# Get DataDir location
|
# Get DataDir location
|
||||||
DATA_DIR="/mnt/data"
|
DATA_DIR="/mnt/data"
|
||||||
case "$(ubnt-device-info firmware || true)" in
|
case "$(ubnt-device-info firmware || true)" in
|
||||||
1*)
|
1*)
|
||||||
DATA_DIR="/mnt/data"
|
DATA_DIR="/mnt/data"
|
||||||
;;
|
;;
|
||||||
2*)
|
2*)
|
||||||
DATA_DIR="/data"
|
DATA_DIR="/data"
|
||||||
;;
|
;;
|
||||||
3*)
|
3*)
|
||||||
DATA_DIR="/data"
|
DATA_DIR="/data"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "ERROR: No persistent storage found." 1>&2
|
echo "ERROR: No persistent storage found." 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
user_authorized_keys_file="$DATA_DIR/ssh/authorized_keys"
|
user_authorized_keys_file="$DATA_DIR/ssh/authorized_keys"
|
||||||
udm_authorized_keys_file="/root/.ssh/authorized_keys"
|
udm_authorized_keys_file="/root/.ssh/authorized_keys"
|
||||||
@ -30,7 +30,7 @@ fi
|
|||||||
# Reads the user file line by line and adds the key to the authorized_keys file
|
# Reads the user file line by line and adds the key to the authorized_keys file
|
||||||
file=$user_authorized_keys_file
|
file=$user_authorized_keys_file
|
||||||
while IFS= read -r line || [ -n "$line" ]; do
|
while IFS= read -r line || [ -n "$line" ]; do
|
||||||
echo $line >>$udm_authorized_keys_file
|
echo $line >$udm_authorized_keys_file
|
||||||
done <"$file"
|
done <"$file"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user