Persistent Hassio to UnRaid SSH RSA Authentication - noodlemctwoodle/Hassio GitHub Wiki
Create RSA Token Home Assistant CLI
-
Create UnRaid Directory in hassio dir
mkdir /config/unraid/.ssh
-
Generate the RSA Key
ssh-keygen
specifiy the location of the output to be
/config/unraid/.ssh/
-
Once an SSH key has been created, the ssh-copy-id command can be used to install it as an authorized key on the server. Once the key has been authorized for SSH, it grants access to the server without a password.
Use a command like the following to copy SSH key:
ssh-copy-id -i /config/unraid/.ssh/rsa_pub user@host
enter the password when requested
-
Once the key has been copied, it is best to test it
ssh -i /config/unraid/.ssh/rsa_pub user@host
-
If the UnRaid server is rebooted before when next section of the guide is completed your SSH keys will get removed from UnRaid and you will need to start again from step 3.
Persistent SSH UnRaid
-
Change permission of authorized_keys to 600:
chmod 600 /root/.ssh/authorized_keys
-
Create a script
/boot/config/ssh/setup_ssh_client.sh
:#!/bin/bash SSH_DIR=/root/.ssh mkdir ${SSH_DIR} chmod 755 ${SSH_DIR} cp /boot/config/ssh/authorized_keys ${SSH_DIR}/authorized_keys chmod 600 ${SSH_DIR}/authorized_keys
-
make it executable:
chmod 755 /boot/config/ssh/setup_ssh_client.sh
-
Copy the previously created
authorized_keys
into/boot/config/ssh
foldercp /root/.ssh/authorized_keys /boot/config/ssh/
-
Edit
/boot/config/go
and add the following line at the end, so that our setup script can be called during reboot:# SSH Script /boot/config/ssh/setup_ssh_client.sh