Hi all, I’ve been trawling through the forums looking for a de facto solution to this, but lots of conflicting messages.
I’ve had a (very) steep learning curve regarding this over the last few days, so be gentle.
I’ve got the basic SFTP secure connection working between client and server using public and private keys.
Got the private key on the client
Got the public key in the /home/root/.ssh directory.
All working great.
But, as (I have discovered is well documented) it’s fine until the WD reboots, or refreshes the file system. when it cleans down these directories. So the .ssh directory gets wiped on reboot (and periodically), and my ‘authorization_key’ file gets wiped.
Before you try to fathom my mind-splurge below, what I am trying to do is set up a way of copying the .ssh directory from a persistent folder (one of the shares) back to /home/root/ regularly, so the private key directory gets copied back across automatically.
I just want to be able to always be able to connect over sftp with a key - the system I have will only connect with one!
MIND SPLURGE BELOW!!!
So I have been trying to set up, through the /usr/local/config/config.xml, a crontab thing (yeah, this is where it gets misty) to call either a ‘cp - rp’ or an ‘rsync’ command to replace the .ssh folder from a persistent copy of it on one of the shares. So that my ‘authorization_key’ file get’s re-written to /home/root/.ssh directory. Infact,
If I ftp in and copy the folder after a reboot, it works fine, but I cannot seem to get it to automatically copy the .ssh/authorization_key file
So how do I do it? Is it a syntax thing? Or am I misunderstanding the whole process?
I followed a tutorial that suggested creating a dummy ‘internal backup’ service via the GUI, then ‘abuse’ (is that right) that call to create a ‘cp’ or ‘sync’ command to re-instate the .ssh folder.
The internal_backup id is listed, and the entry for it has been changed to:
internal_backup
item id=“1”
method>3</method
1>/5</1
2>0</2
3>0</3
4>0</4
5>0</5
run>/usr/sbin/rsync -a /mnt/HD/HD_a2/Red90/Tech/FTP_settings/DoNotDelete /home/root </run
/item
/internal_backup
(all lines missing the < at the beginning and > at the end so they will appear here, the asterisks don’t show up, so I have replaced them with an ‘0’ for this)
The only content in the source folder is the .ssh folder I need to reinstate in /home/root/
From what I have read, I thought this would create an automatic copy of the stored .ssh folder back to /home/root/ every 5 mins
Can anyone guide what I’ve done wrong? Do I use ‘rsync’, ‘cp’, do I need to put the (ignore the dots) ‘&.amp.;’ in the line?
Or in other words, how do I get the NAS to copy my file from a persistent location to the /home/root directory on reboot and periodically.
I am out of my knowledge space here, but on the edges of my comfort zone.