lutiana Posted June 9, 2020 Posted June 9, 2020 I have another server setup that I would like to do some daily backups of. It supports backing up via SSH. So I went through and setup the /root/.ssh/known_hosts file with the public key from the other server and it was all working great. But then I rebooted unraid and to my surprise the setup was completely gone and my backups started failing. So is there a way to make this change persist through reboots? Quote
itimpi Posted June 9, 2020 Posted June 9, 2020 Unraid runs from RAM which is why it did not survive a reboot. If you want any file to survive a reboot then you need to store a copy on the flash drive and copy it into its runtime position using either entries in the config/go file or using the User Scripts plugin. Quote
lutiana Posted June 10, 2020 Author Posted June 10, 2020 5 hours ago, itimpi said: Unraid runs from RAM which is why it did not survive a reboot. If you want any file to survive a reboot then you need to store a copy on the flash drive and copy it into its runtime position using either entries in the config/go file or using the User Scripts plugin. Thanks! I installed the plugin, and created the script. I assume that I can put the authorized_keys file in the same place as the script and it won't be deleted or lost at a reboot? Also, how do I schedule this to run at boot? The only cron options seem to have to do with the array startup and spin-down. Quote
itimpi Posted June 10, 2020 Posted June 10, 2020 2 hours ago, lutiana said: Thanks! I installed the plugin, and created the script. I assume that I can put the authorized_keys file in the same place as the script and it won't be deleted or lost at a reboot? Also, how do I schedule this to run at boot? The only cron options seem to have to do with the array startup and spin-down. You cannot (currently at least) schedule items via the User Scripts plugin to run at boot (although it has been hinted some additional scheduling options might be added). If you want it run as part of the boot process then add the commands to the config/go file on the usb drive. Quote
Squid Posted June 10, 2020 Posted June 10, 2020 1 hour ago, itimpi said: although it has been hinted some additional scheduling options might be added Boot time scheduling will never be added. 1 Quote
Hoopster Posted June 11, 2020 Posted June 11, 2020 9 hours ago, lutiana said: Thanks! I installed the plugin, and created the script. I assume that I can put the authorized_keys file in the same place as the script and it won't be deleted or lost at a reboot? I am doing backups from one server to another via rsync/ssh. I use a combination of go file entries to keep things persistent through reboots and User Scripts to run the backup on a scheduled basis. Here is an example of my go file entries in the source server to copy what is needed to access the backup server. There are similar entries in the go file of the backup server referencing the source server. # Copy SSH files back to /root/.ssh folder and set permissions for files mkdir -p /root/.ssh cp /boot/config/ssh/medianas_key /root/.ssh/id_rsa cp /boot/config/ssh/known_hosts /root/.ssh/known_hosts cat /boot/config/ssh/backupnas_key.pub > /root/.ssh/authorized_keys chmod g-rwx,o-rwx -R /root/.ssh Been running the script for over two years without issue and through many, many reboots of both servers. Quote
lutiana Posted June 11, 2020 Author Posted June 11, 2020 (edited) On 6/10/2020 at 1:20 PM, Squid said: Boot time scheduling will never be added. Is there a particular reason for this? I ask out of curiosity more than anything. Edited June 11, 2020 by lutiana Quote
lutiana Posted June 11, 2020 Author Posted June 11, 2020 On 6/10/2020 at 12:05 PM, itimpi said: config/go file Can you tell me where I find this file? Quote
Hoopster Posted June 11, 2020 Posted June 11, 2020 44 minutes ago, lutiana said: Can you tell me where I find this file? It's on your unRAID USB boot flash drive. Quote
lutiana Posted June 12, 2020 Author Posted June 12, 2020 1 hour ago, Hoopster said: It's on your unRAID USB boot flash drive. Well I mean, I figured that, but what is the exact path that is in? Or does that vary from install to install? Quote
JonathanM Posted June 12, 2020 Posted June 12, 2020 10 minutes ago, lutiana said: Well I mean, I figured that, but what is the exact path that is in? Or does that vary from install to install? Depends where you access it from. \\tower\flash\config\go over SMB, /boot/config/go over SSH or at the console, X:\config\go where X is the mounted drive letter if you put the USB stick in your windows box. Quote
lutiana Posted June 12, 2020 Author Posted June 12, 2020 3 minutes ago, jonathanm said: Depends where you access it from. \\tower\flash\config\go over SMB, /boot/config/go over SSH or at the console, X:\config\go where X is the mounted drive letter if you put the USB stick in your windows box. Perfect, thanks! Quote
Hoopster Posted June 12, 2020 Posted June 12, 2020 Well I mean, I figured that, but what is the exact path that is in? Or does that vary from install to install?Well, you did say “where do I find this file?” not, “what is the path for accessing this file?” [emoji3]Sent from my iPhone using Tapatalk Quote
limetech Posted July 9, 2020 Posted July 9, 2020 On 6/10/2020 at 7:18 PM, Hoopster said: I am doing backups from one server to another via rsync/ssh. I use a combination of go file entries to keep things persistent through reboots and User Scripts to run the backup on a scheduled basis. Here is an example of my go file entries in the source server to copy what is needed to access the backup server. There are similar entries in the go file of the backup server referencing the source server. # Copy SSH files back to /root/.ssh folder and set permissions for files mkdir -p /root/.ssh cp /boot/config/ssh/medianas_key /root/.ssh/id_rsa cp /boot/config/ssh/known_hosts /root/.ssh/known_hosts cat /boot/config/ssh/backupnas_key.pub > /root/.ssh/authorized_keys chmod g-rwx,o-rwx -R /root/.ssh Been running the script for over two years without issue and through many, many reboots of both servers. I want to make a little change that will make files in /root/.ssh persistent but will affect your script. That is simply this: create /root/.ssh which is a symlink to /boot/config/ssh/root /boot/config/ssh/root is a directory where you put authorized_keys, known_hosts, etc. Sound good? 3 1 Quote
Hoopster Posted July 9, 2020 Posted July 9, 2020 (edited) 10 hours ago, limetech said: Sound good? Yes, it does. It certainly simplifies things. It will be easy enough to modify any scripts/go file entries that reference /root/.ssh and the files in /boot/config/ssh/root Edited July 9, 2020 by Hoopster 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.