mirror of
https://github.com/fire1ce/UDM-Persistent-SSH-Keys.git
synced 2023-10-10 11:36:54 +00:00
Merge pull request #8 from magicdude4eva/main
Improved firmware compatibility
This commit is contained in:
commit
14f32bd044
13
README.md
13
README.md
@ -10,10 +10,13 @@ This can be accomplished with a boot script. Flow this guide: [UDM / UDMPro Boot
|
|||||||
- Tested on [UDM PRO][amz-udm-pro-url]
|
- Tested on [UDM PRO][amz-udm-pro-url]
|
||||||
- UDM Pro doesn't support **ed25519** SSH Keys
|
- UDM Pro doesn't support **ed25519** SSH Keys
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
The script was tested on UDM PRO
|
The script was tested on UDM PRO
|
||||||
|
|
||||||
|
(!) Depending on firmware your `$DATA_DIR` will be `/mnt/data` (Firmware 1.x) or `/data` (Firmware 2.x and 3.x)
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl -s https://raw.githubusercontent.com/fire1ce/UDM-Persistent-SSH-Keys/main/install.sh | sh
|
curl -s https://raw.githubusercontent.com/fire1ce/UDM-Persistent-SSH-Keys/main/install.sh | sh
|
||||||
```
|
```
|
||||||
@ -21,7 +24,7 @@ curl -s https://raw.githubusercontent.com/fire1ce/UDM-Persistent-SSH-Keys/main/i
|
|||||||
Add you public RSA keys to:
|
Add you public RSA keys to:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
/mnt/data/ssh/authorized_keys
|
$DATA_DIR/ssh/authorized_keys
|
||||||
```
|
```
|
||||||
|
|
||||||
## Uninstall
|
## Uninstall
|
||||||
@ -29,23 +32,23 @@ Add you public RSA keys to:
|
|||||||
Delete the 99-ssh-keys.sh file
|
Delete the 99-ssh-keys.sh file
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
rm -rf /mnt/data/on_boot.d/99-ssh-keys.sh
|
rm -rf $DATA_DIR/on_boot.d/99-ssh-keys.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
Delete your authorized_keys file
|
Delete your authorized_keys file
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
rm -rf /mnt/data/ssh/authorized_keys
|
rm -rf $DATA_DIR/ssh/authorized_keys
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
At boot the script with read the **/mnt/data/ssh/authorized_keys** file and add the content to UDM's **/root/.ssh/authorized_keys**
|
At boot the script with read the **$DATA_DIR/ssh/authorized_keys** file and add the content to UDM's **/root/.ssh/authorized_keys**
|
||||||
|
|
||||||
Manual run:
|
Manual run:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
/mnt/data/on_boot.d/99-ssh-keys.sh
|
$DATA_DIR/on_boot.d/99-ssh-keys.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- --- -->
|
<!-- --- -->
|
||||||
|
@ -19,6 +19,7 @@ case "$(ubnt-device-info firmware || true)" in
|
|||||||
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"
|
||||||
|
|
||||||
curl -sO https://raw.githubusercontent.com/fire1ce/UDM-Persistent-SSH-Keys/main/99-ssh-keys.sh
|
curl -sO https://raw.githubusercontent.com/fire1ce/UDM-Persistent-SSH-Keys/main/99-ssh-keys.sh
|
||||||
mv 99-ssh-keys.sh $DATA_DIR/on_boot.d/99-ssh-keys.sh
|
mv 99-ssh-keys.sh $DATA_DIR/on_boot.d/99-ssh-keys.sh
|
||||||
@ -28,8 +29,9 @@ echo "99-ssh-keys.sh installed"
|
|||||||
if [ ! -f "$user_authorized_keys_file" ]; then
|
if [ ! -f "$user_authorized_keys_file" ]; then
|
||||||
echo "Creating $user_authorized_keys_file"
|
echo "Creating $user_authorized_keys_file"
|
||||||
mkdir -p $DATA_DIR/ssh
|
mkdir -p $DATA_DIR/ssh
|
||||||
touch "$user_authorized_keys_file"
|
mkdir -p /root/.ssh/
|
||||||
chmod 0644 "$user_authorized_keys_file"
|
touch "$user_authorized_keys_file $udm_authorized_keys_file"
|
||||||
|
chmod 0644 "$user_authorized_keys_file $udm_authorized_keys_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "==> Add you public keys to $user_authorized_keys_file"
|
echo "==> Add you public keys to $user_authorized_keys_file"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user