Persistent Hassio to UnRaid SSH RSA Authentication - noodlemctwoodle/Hassio GitHub Wiki

Create RSA Token Home Assistant CLI

  1. Create UnRaid Directory in hassio dir

     mkdir /config/unraid/.ssh
    
  2. Generate the RSA Key

     ssh-keygen
    

    specifiy the location of the output to be /config/unraid/.ssh/

  3. 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

  1. Once the key has been copied, it is best to test it

     ssh -i /config/unraid/.ssh/rsa_pub user@host
    
  2. 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

  1. Change permission of authorized_keys to 600:

     chmod 600 /root/.ssh/authorized_keys
    
  2. 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
    
  3. make it executable:

     chmod 755 /boot/config/ssh/setup_ssh_client.sh
    
  4. Copy the previously created authorized_keys into /boot/config/ssh folder

     cp /root/.ssh/authorized_keys /boot/config/ssh/
    
  5. 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