Front page

using obnam on a synology server

70391c09cee243a689a65fc6901976ec
GUIDANCE CORPORATE BEFRIEND

From: Sharon Kimble <boudiccas@skimble.plus.com>
Date: Thu, 03 Aug 2017 12:17:44 +0100

   I've recently acquired a synology box and have spent a long time getting
   it set up so that I can backup using obnam to it. Currently, I can back
   up to it, and restore from it, but - with each operation it =always=
   asks for my ssh keyphrase, and I haven't found any way round it as yet.
   
   This is my obnam conf file for it -
   
   --8<---------------cut here---------------start------------->8---
   [config]
   
   # repository = sftp://boztu@192.168.1.108/NetBackup/obnam
   repository = sftp://boztu@192.168.1.108/homes/boztu/obnam
   root = /home/boudiccas/kindle5
   client-name = London
   # ssh = boxname
   # compress-with = gzip
   keep = 14d,5w,6m
   lru-size=1024
   upload-queue-size=512
   #upload-queue-size=4096
   chunk-size=67108864
   checkpoint=8G
   log = /home/boudiccas/logs/obsyn.txt
   log-level = info
   log-keep = 5
   log-max = 25 mb
   log-mode = 0600
   --8<---------------cut here---------------end--------------->8---
   
   This is my bash script to run it -
   
   --8<---------------cut here---------------start------------->8---
   #!/bin/bash
   
   #: Title			: obsync
   #: Date				: 03 August 2017
   #: Author			: Sharon Kimble
   #: Version			: 1.0
   #: Description			: script to help in running obnam for backups to a synology box
   #: License			: GNU GPL 3.0 or later
   ####################################################
   # How to use.
   # Change the lines in the '#Variables' section to fit your situation and your file tree. And save it in ~/bin/notify, and then run 'chmod +x ~/bin/notify' to make it executable.
   # Then put an entry for it in your crontab, this is mine -
   # 00 */2 * * * DISPLAY=:0 /home/boudiccas/bin/obmusic	#backup /home and let it run every 2 hours for backups.
   ####################################################
   # Variables
   logfile="/home/boudiccas/logs/ob-sync.txt"
   obsyn="/home/boudiccas/cron/conf/obsyn.conf"
   # obsynology="sftp://boztu@192.168.1.108/NetBackup/obnam"
   ####################################################
   
   /usr/bin/notify-send "Starting obnam-synology backup..."
    
   exec > >(tee -a $logfile) 2>&1
   
   obnam --config="$obsyn" backup
   
   if [ "$?" -ne 0 ]; then
     notify-send "Unable to finish obnam-synology backup."
     exit 1
   else
     
   #  du -sh "$obsynology"
       
   echo 'Sending Backup report : Backup to obnam-synology completed', "$(date -R)" 'logged to' "$logfile"
   echo '####################################'
   
     notify-send "Finished obnam-synology backup."
   
   fi
   --8<---------------cut here---------------end--------------->8---
   
   There is a lot of stuff commented out in both scripts from where I've
   tried various things, which have been left in to show what doesn't work.
   
   I have generated a new key-pair in ssh, and saved the public key to
   ./ssh on the synology box but its failing to recognise that and asking
   at every command for my keyphrase.
   
   On the box itself I have the following setup -
   
   --8<---------------cut here---------------start------------->8---
   - boxname
     | - homes 
         | - admin
         | - boztu
             | - obnam
             | - .ssh
             | authorised_keys
   --8<---------------cut here---------------end--------------->8---
   
   I have tried following these pages [1], [2], [3] and [4], but they don't
   seem to affect running obnam at all as I keep being asked for my
   passphrase.
   
   So can any kind soul please help me out with not being asked for my
   passphrase as part of a bash script or obnam conf please?
   
   Thanks
   Sharon.
   
   [1] https://www.chainsawonatireswing.com/2012/01/15/ssh-into-your-synology-diskstation-with-ssh-keys/?from=@
   [2] http://www.chainsawonatireswing.com/2012/01/16/log-in-to-a-synology-diskstation-using-ssh-keys-as-a-user-other-than-root/
   [3] http://www.chainsawonatireswing.com/2012/01/17/change-the-ssh-port-you-use-to-log-in-to-a-synology-diskstation/
   [4] http://www.chainsawonatireswing.com/2012/01/22/log-in-to-a-synology-diskstation-quicker-easier-using-an-ssh-config-file/
From: "Neal H. Walfield" <neal@walfield.org>
Date: Thu, 03 Aug 2017 14:36:31 +0200

   At Thu, 03 Aug 2017 12:17:44 +0100,
   Sharon Kimble wrote:
   > 
   >           | - obnam
   >           | - .ssh
   >           | authorised_keys
   
   It's spelt with a z (authorized_keys) and is under the .ssh directory,
   not the home directory.
   
   HTH,
   
   :) Neal
   
   _______________________________________________
   obnam-support mailing list
   obnam-support@obnam.org
   http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/obnam-support-obnam.org
From: Sharon Kimble <boudiccas@skimble.plus.com>
Date: Thu, 03 Aug 2017 16:49:30 +0100

   "Neal H. Walfield" <neal@walfield.org> writes:
   
   > At Thu, 03 Aug 2017 12:17:44 +0100,
   > Sharon Kimble wrote:
   >> 
   >>           | - obnam
   >>           | - .ssh
   >>           | authorised_keys
   >
   > It's spelt with a z (authorized_keys) and is under the .ssh directory,
   > not the home directory.
   
   Agreed about the z, it is actually there as 'authorized' in the .ssh
   directory, I just miss-spelt it in my original email.
   
   Each separate user has its own server space, and a size quota can be set
   for how much server space they actually have, which I assume is pretty
   standard on servers. But there seems to be no way in which you can
   manually add, or move, the .ssh directory into the boxname directory.
   Although I have set it up using ext4 it doesn't seem to be running linux
   but rather some sort of android OS which synology call 'DSM'. So it
   seems that I'm stuck with it for the time being.
   
   Thanks
   Sharon.
From: Adam Porter <adam@alphapapa.net>
Date: Wed, 23 Aug 2017 20:55:55 -0500

   Try opening ~/.ssh/config on your source machine (not the backup server)
   and add a line like:
   
   IdentityFile ~/.ssh/backup-key/id_dsa
   
   Add that line after the lines for any other SSH keys you use.  e.g. my
   file starts with:
   
   IdentityFile ~/.ssh/id_dsa
   Identityfile ~/.ssh/id_rsa
   IdentityFile ~/.ssh/backup-key/id_dsa
   
   It works without having to enter a passphrase, because SSH tries each
   key before asking for a passphrase, and the backup server has the
   backup-key in the backup user's authorized_keys file.
   
   
   _______________________________________________
   obnam-support mailing list
   obnam-support@obnam.org
   http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/obnam-support-obnam.org
From: Sharon Kimble <boudiccas@skimble.plus.com>
Date: Thu, 24 Aug 2017 09:22:18 +0100

   Adam Porter <adam@alphapapa.net> writes:
   
   > Try opening ~/.ssh/config on your source machine (not the backup server)
   > and add a line like:
   >
   > IdentityFile ~/.ssh/backup-key/id_dsa
   >
   > Add that line after the lines for any other SSH keys you use.  e.g. my
   > file starts with:
   >
   > IdentityFile ~/.ssh/id_dsa
   > Identityfile ~/.ssh/id_rsa
   > IdentityFile ~/.ssh/backup-key/id_dsa
   >
   > It works without having to enter a passphrase, because SSH tries each
   > key before asking for a passphrase, and the backup server has the
   > backup-key in the backup user's authorized_keys file.
   
   Thanks for this, I'll definetly have a try with this when I get my
   synology back online, its currently down whilst I have some building
   works done on my flat.
   
   Thanks
   Sharon.