Jump to content

Why no persistent changes to root home folder?


Recommended Posts

Posted

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?

Posted

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.

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

 

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

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

Posted (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 by lutiana
Posted
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?

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

Posted
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!

Posted
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
  • 4 weeks later...
Posted
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?

 

  • Like 3
  • Thanks 1
Posted (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 by Hoopster
  • Thanks 1

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...