ALT-F Backup - no ssh keys copied or text file created when backup created.

229 views
Skip to first unread message

dicky...@gmail.com

unread,
Feb 10, 2015, 11:34:09 AM2/10/15
to al...@googlegroups.com
Sorry to post this, but I have trawled the forum and cant see an answer to this.

I have Alt-F 0.1RC4.1 and have enabled backup and setup a rsync backup and I want to use the ssh keys option but there is nothing in either /root or /home/dicky (the user). There is also no authorized keys off the root of the disk (only 1 disk installed at the moment) :-

[root@DNS-BACKUP]# ls -al /home/dicky
total 12
drwx--s--x    2 dicky    users         4096 Feb  8 19:37 .
drwxr-xr-x    3 root     root          4096 Feb  8 18:42 ..
-rw-------    1 dicky    users          112 Feb  8 20:27 .ash_history


[root@DNS-BACKUP]# ls /mnt/sda2/authorized_keys2
ls: /mnt/sda2/authorized_keys2: No such file or directory
[root@DNS-BACKUP]# ls -al /mnt/sda2/
total 76
drwxr-xr-x    7 root     root          4096 Feb 10 16:20 .
drwxr-xr-x    3 root     root            60 Feb  8 20:42 ..
drwxr-xr-x    7 root     root          4096 Feb 10 16:19 Alt-F
drwxrwxr-x    3 backup   backup        4096 Feb 10 16:20 Backup
dr-xr-xr-x    4 root     root          4096 Feb  8 18:42 Public
drwxr-xr-x    3 root     root          4096 Feb  8 18:42 Users
-rw-rw-rw-    1 root     root         38536 Feb  8 20:43 alt-f.log
drwx------    2 root     root         16384 Feb  8 18:41 lost+found


Backup.conf:-
[root@DNS-BACKUP]# cat /etc/backup.conf
#id;type;runas;host;mac;srcpath;dstpath;when;at;log;nrotate
#0;rsync;root;10.0.1.100;70:62:b8:2a:54:40;/mnt/sdb2/video;/Backup;6;0;no;1
1;rsync;dicky;10.0.1.3;00:26:b9:b7:83:50;/media/hit;/Backup;6;6;no;1

Can I create the keys manually or kick off a script to creat
e them and also the text file that tells me what to do as per the help file?

regards,

Dicky
Message has been deleted

João Cardoso

unread,
Feb 10, 2015, 1:24:46 PM2/10/15
to al...@googlegroups.com


On Tuesday, February 10, 2015 at 4:34:09 PM UTC, dicky...@gmail.com wrote:
Sorry to post this, but I have trawled the forum and cant see an answer to this.

I have Alt-F 0.1RC4.1 and have enabled backup and setup a rsync backup and I want to use the ssh keys option but there is nothing in either /root or /home/dicky (the user). There is also no authorized keys off the root of the disk (only 1 disk installed at the moment) :-

They will be created when the backup is performed the first time, if needed.
I created a rsync backup using the webUI, which generates:

[root@dns-320l]# cat /etc/backup.conf 
#id;type;runas;host;mac;srcpath;dstpath;when;at;log;nrotate
0;rsync;jcard;silver;;home;/Backup;0;6;no;3

Then performed the first backup:
 
[root@dns-320l]# backup 0

The log says: 

[root@dns-320l]# cat /var/log/backup.log 

DATE=Tue Feb 10 18:12:49 WET 2015
backup: Doing backup: id=0 type=rsync runas=jcard host=silver srcpath=home  dstpath=/Backup when=0 at=6 log=no nlogs=3
NO rsync module
Generating key, this may take a while...
Public key portion is:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3fT1rXWKT5wPhGlTBavCdFQZ4Hqb9L7QtAUwuH+3I846xLi9JcYceMFKo6vtpkyUXk70yKdZmz5bxrRQybLsVVIGJhiQVhkmyO1TKyOHcCqUA4UqmBwFZ1jXzopSNWLcDFrBLUYntvGkdpg6S43MB6+J1kkl5sFY7f2ck9TB8eZghDDrM/OSkjlHKKawWO7B3BtGEo1AKuuItzmidu2yVOIZ/z+JWymAc3XSAaHorIskusMaw9hXL2v57GRkf3Rn84BiHkDiZ6/1C85lov0AxsM7NyvzJMER53/XAIjLRIAxElcXFswBTBhvLNvki4p45fhakJfQXAlVXFZTWtPSp root@dns-320l
Fingerprint: md5 6e:1b:ef:06:bc:13:d2:b0:1a:d5:dc:07:be:ff:7d:0b
backup: ID 0: ssh keys have been created for you.
You must now setup a trusted password-less connection from host dns-320l
to host silver. This can't be automated, manual intervention is needed:
1-Logged in as user jcard at host silver you should execute the commands
        cd      # change to your home directory
        scp dns-320l:.ssh/id_rsa.pub . # copy public key generated at dns-320l to silver
        cat id_rsa.pub >> .ssh/authorized_keys # allow password-less connection from dns-320l
2-Login as user jcard to host dns-320l and execute the command
        ssh silver # this will make dns-320l a trusted host to host silver
After accepting, you can logout.

And at the jcard home folder:

[root@dns-320l]# ls -Rla /home/Joao\ Cardoso/
/home/Joao Cardoso/:
total 16
drwx--s--x    3 jcard    users         4096 Feb 10 18:12 .
drwxr-xr-x    3 root     root          4096 Feb  2 18:40 ..
drwxr-sr-x    2 jcard    users         4096 Feb 10 18:12 .ssh
-rw-rw-rw-    1 root     users          623 Feb 10 18:12 Backup-rsync-ssh.txt

/home/Joao Cardoso/.ssh:
total 20
drwxr-sr-x    2 jcard    users         4096 Feb 10 18:12 .
drwx--s--x    3 jcard    users         4096 Feb 10 18:12 ..
-rw-------    1 jcard    users          805 Feb 10 18:12 id_rsa
-rw-r--r--    1 jcard    users          395 Feb 10 18:12 id_rsa.pub
-rw-------    1 jcard    users          805 Feb 10 18:12 identity

If you want to use existing keys, drop them at the proper place and they will be used. The backup script generates keys when no "runas"/.ssh/identity file exists.

Notice that the NFS and CIFS backup modules also use rsync internally (all backup methods does), after NFS/CIFS mounting the remote filesystem locally.

dicky...@gmail.com

unread,
Feb 10, 2015, 2:25:57 PM2/10/15
to al...@googlegroups.com
Wow, thanks for your quick response, I will give it a go now!

Dicky

dicky...@gmail.com

unread,
Feb 10, 2015, 3:20:30 PM2/10/15
to al...@googlegroups.com
Well, I tried again and still no rsa key is geerated. If I set the backup away with backup 0 or 1 the command just sits there and never returns to a prompt - either logged in as the user or as root. It does this on 2 diferent altF installs on 320L boxes - examples of output are below.

What I do notice is the directory attributes for my user differ from your example (I have never seen 'S' before -

mine is - drwx--S---    2 dicky    users         4096 Feb 10 19:59 .ssh

Yours is - 
drwxr-sr-x    2 jcard    users         4096 Feb 10 18:12 .ssh

my terminal outputs are:-

$ ls -al
total 16
drwx--s--x    3 dicky    users         4096 Feb 10 19:59 .

drwxr-xr-x    3 root     root          4096 Feb  8 18:42 ..
-rw-------    1 dicky    users          291 Feb 10 20:05 .ash_history
drwx--S---    2 dicky    users         4096 Feb 10 19:59 .ssh
$ ls -al .ssh
total 8
drwx--S---    2 dicky    users         4096 Feb 10 19:59 .
drwx--s--x    3 dicky    users         4096 Feb 10 19:59 ..
-rw-r--r--    1 dicky    users            0 Feb 10 19:59 known_hosts
$
$ cat /var/log/backup.log

DATE=Tue Feb 10 19:33:50 GMT 2015
backup: Doing backup: id=0 type=rsync runas=dicky host=10.0.1.100 srcpath=/mnt/sdb2/video  dstpath=/Backup when=6 at=0 log=no nlogs=1

DATE=Tue Feb 10 20:05:23 GMT 2015
backup: Doing backup: id=1 type=rsync runas=dicky host=10.0.1.3 srcpath=/bascom  dstpath=/Backup when=6 at=0 log=no nlogs=2


[root@DNS-BACKUP]# cat /etc/backup.conf
#id;type;runas;host;mac;srcpath;dstpath;when;at;log;nrotate
#0;rsync;dicky;10.0.1.100;70:62:b8:2a:54:40;/mnt/sdb2/video;/Backup;6;0;no;1
1;rsync;dicky;10.0.1.3;00:26:b9:b7:83:50;/bascom;/Backup;6;0;no;2
[root@DNS-BACKUP]# backup 1


Can I create the rsa key separately? I tried using ssh-keygen but that deosnt exist so I guess theres another program to use?

Dicky

João Cardoso

unread,
Feb 10, 2015, 7:35:25 PM2/10/15
to al...@googlegroups.com


On Tuesday, February 10, 2015 at 8:20:30 PM UTC, dicky...@gmail.com wrote:
Well, I tried again and still no rsa key is geerated. If I set the backup away with backup 0 or 1 the command just sits there and never returns to a prompt

Please edit /usr/bin/backup, uncomment the 'set -x' near the top and execute the backup; the log will hopefully show where the script is hanging. Please report back it contents.

Make sure that there isn't a backup already running or waiting for something, /var/lock/backup.lockdir shouldn't exists and /var/run/backup.pid shouldn't exists or contain the pid of a stale backup script. /Backup must be a valid link to a folder on a filesystem, or the script will hang trying to dereference it.
 
- either logged in as the user or as root. It does this on 2 diferent altF installs on 320L boxes - examples of output are below.

What I do notice is the directory attributes for my user differ from your example (I have never seen 'S' before -

You haven't create the user using the webUI, haven't you? Some features might depends on group permissions.

dicky...@gmail.com

unread,
Feb 11, 2015, 11:16:47 AM2/11/15
to al...@googlegroups.com
Hello again - thanks for the assistance.

1 I uncommented the line and the output is below.
2 There was a stale .pid file which I deleted as there was no such process.
3 /Backup does point to a valid filesystem
4 Yes, I created the user in the web browser not the command prompt.
5 What I noticed from the backup log is that the line SERRORL=/var/log/systemerror.log does not point to a valid file - it does not exist.
6 I used the ping commandline from the log to ping the end device which it did.

Here is the backup log output and some directory listing info before I removed the .pid file - the end part just keeps repeating itself.

[root@DNS-BACKUP]# ls /var/lock
subsys

[root@DNS-BACKUP]# ls /var/run/
backup.pid      ifstate         smbd.pid        utmp
crond.pid       inetd.pid       sysctrl.pid     vsftpd
dns320l.socket  nmbd.pid        syslogd.pid

[root@DNS-BACKUP]# cat /var/run/backup.pid
3410
[root@DNS-BACKUP]# ps -ef |grep 3410
 3801 root     grep 3410
[root@DNS-BACKUP]#

[root@DNS-BACKUP]# ls /Backup
Backup.old


Backup.log output below.......


DATE=Tue Feb 10 20:05:23 GMT 2015
backup: Doing backup: id=1 type=rsync runas=dicky host=10.0.1.3 srcpath=/bascom  dstpath=/Backup when=6 at=0 log=no nlogs=2
+ date
+ echo -e \nDATE=Wed Feb 11 15:57:04 GMT 2015

DATE=Wed Feb 11 15:57:04 GMT 2015
+ CONF_BACKUP=/etc/backup.conf
+ SERRORL=/var/log/systemerror.log
+ lockfile=/var/lock/backup.lockdir
+ test 1 = 0
+ details 0
+ IFS=;
+ read id type runas host mac srcpath dstpath when at log nlogs rest
+ test -z #id -o -z type -o -z runas -o -z srcpath -o -z dstpath -o -z when -o -z at -o -z log -o -z nrotate
+ test # = #
+ continue
+ read id type runas host mac srcpath dstpath when at log nlogs rest
+ test -z 0 -o -z rsync -o -z dicky -o -z /mnt/sdb2/video -o -z /Backup -o -z 6 -o -z 0 -o -z no -o -z 1
+ test 0 = #
+ test 0 = 0
+ return 0
+ readlink -f /Backup
+ tmp=/mnt/sda2/Backup
+ test -d /mnt/sda2/Backup
+ mountpoint -q /mnt/sda2/Backup
+ dirname /mnt/sda2/Backup
+ tmp=/mnt/sda2
+ mountpoint -q /mnt/sda2
+ test /mnt/sda2 = / -o /mnt/sda2 = .
+ exclusive
+ lock
+ mkdir /var/lock/backup.lockdir
+ test -e /var/run/backup.pid
+ echo 967
+ echo In progress
+ unlock
+ rmdir /var/lock/backup.lockdir
+ logger -st backup Doing backup: id=0 type=rsync runas=dicky host=10.0.1.100 srcpath=/mnt/sdb2/video  dstpath=/Backup when=6 at=0 log=no nlogs=1

backup: Doing backup: id=0 type=rsync runas=dicky host=10.0.1.100 srcpath=/mnt/sdb2/video  dstpath=/Backup when=6 at=0 log=no nlogs=1
+ rsync_backup
+ wakeup
+ ping -W 3 -c 2 10.0.1.100
+ return 0
+ mktemp -t backup-XXXXXX
+ tf=/tmp/backup-mJZhSE
+ chmod og-r /tmp/backup-mJZhSE
+ mod=/mnt/sdb2/video
+ dirname /mnt/sdb2/video
+ test /mnt/sdb2 != .
+ dirname /mnt/sdb2/video
+ mod=/mnt/sdb2
+ dirname /mnt/sdb2
+ test /mnt != .
+ dirname /mnt/sdb2
+ mod=/mnt
+ dirname /mnt
+ test / != .
+ dirname /mnt
+ mod=/
+ dirname /
+ test / != .
+ dirname /
+ mod=/
+ dirname /
+ test / != .
+ dirname /


João Cardoso

unread,
Feb 11, 2015, 12:23:48 PM2/11/15
to al...@googlegroups.com
ah, this is it, your source folder to backup is /mnt/sdb2/video, and (my fault), for rsync the source folders must not be absolute (i.e., starting with /), so the script loops trying to get the first path folder name.

And why did I assume that the source folders would not absolute?

-For the rsync daemon mode, the "folder" is the name of a rsync module, and it is a name: The Folder entry must start with the daemon module name to backup.

-For the rsync/ssh mode, I assumed that the folder to backup is a subfolder of the runas user home folder, so it would be relative.
But that does not contemplate your other backup, the one with srcpath=/bascom, which is a legitime choice. For that you have to create a link from your home folder to the bascon folder, e.g., 'ln -sf /home/dicky/bascom  /bascom' -- don' know if that will work.

See the Backup online help.

Anyway, if all you want to do is to backup a folder in the box from one disk to the other, you should use the Dir type. It will use rsync. *All* backup types uses rsync.

And why do I favour NFS/CIFS backups against pure rsync? When used across the network rsync uses ssh as its transport medium, and ssh uses cryptography, which is slow for our little boxes. On a DNS-323 ssh runs at 2MBs, while NFS/CIFS runs at 10/12 MBs.
Mounting the remote folder by NFS/CIFS locally in the box and then using rsync to do the local backup will be the best of two worlds: high NFS/CIFS throughput and rsync synchronization abilities.
Of course if you don't want your data to travel the wire in the clear you will want to use pure rsync.

 ...

+ mod=/mnt/sdb2/video
+ dirname /mnt/sdb2/video
+ test /mnt/sdb2 != .
+ dirname /mnt/sdb2/video
+ mod=/mnt/sdb2
+ dirname /mnt/sdb2
+ test /mnt != .
+ dirname /mnt/sdb2
+ mod=/mnt
+ dirname /mnt
+ test / != .
+ dirname /mnt
+ mod=/
+ dirname /
+ test / != .
+ dirname /
+ mod=/
+ dirname /
+ test / != .
+ dirname /



There it is, an endless loop.
 

dicky...@gmail.com

unread,
Feb 11, 2015, 2:35:11 PM2/11/15
to al...@googlegroups.com
João, thanks again for your quick replies!

To be honest, I only used rsync because my little web server is linux based and I use scp and rsync to copy to and from it - no other reason.
Yes, all I want to do is backup the 2 disks on my primary dns320L to another I have over my home net so encryption in not necessary.

So I setup cifs to copy from one dns320L to my backup dns320L and it worked first time and took seconds!

I especially liked your 'browse' button - made it very simple to choose the network share - lovely touch!

Well, I hope I have helped a bit pointing out a potential bug/feature in the backup routine!

Regards, and thanks again!

dicky
Reply all
Reply to author
Forward
0 new messages