BackupPC-users

[BackupPC-users] $Conf{SshPath} and expect script

2008-10-04 15:57:21
Subject: [BackupPC-users] $Conf{SshPath} and expect script
From: Jean-Michel Beuken <jean-michel.beuken AT uclouvain DOT be>
To: "General list for user discussion, questions and support" <backuppc-users AT lists.sourceforge DOT net>
Date: Sat, 04 Oct 2008 21:55:51 +0200
Hello,

When we add a new PC with ssh/rsync transfer method, at the first 
time, we must accept the "public key" and then, we must type "yes" at the 
question :

-------------------
The authenticity of host 'coba (xxx.xxx.xxx.xxx)' can't be established.
RSA key fingerprint is 6f:7f:45:99:59:02:15:cf:12:7b:78:f9:6b:1c:f8:60.
Are you sure you want to continue connecting (yes/no)?
-------------------

Otherwise, the famous error appears : "Unable to read 4 bytes"

INFO : the public key (without passphrase) of user backuppc is already 
installed in the client...

Then, if I want that the answer is automatic, I have tried to use a expect 
script 
(/usr/local/bin/SSH) that catches this problem (I'm not a expect expert !)
and I put this script in the backupPC variable 

$Conf{SshPath} = '/usr/local/bin/SSH';

The script :

-----the SSH script --------------
#!/usr/bin/expect --

set log_user 1
set timeout 10
set argc [llength $argv]
set remotehost [lindex $argv 0]
set cmd ""
for { set i 1} {$i<$argc} {incr i} {
   append cmd " [lindex $argv $i]"
}

spawn ssh $remotehost $cmd
expect {
   "Are you sure you want to continue connecting (yes/no)?" {
           send -- "yes\r";
           set timeout -1;
           exp_continue -continue_timer;
           }
}
wait;
-----------------------------------------------------------------

this script works well "outside" the BackupPC but doesn't works with BackupPC :

here is a part of the output of BackupPC_dump :

----------------------------
/usr/local/BackupPC/bin/BackupPC_dump -v -i coba

cmdSystemOrEval: about to system /bin/ping -c 1 -w 3 coba.pcpm.ucl.ac.be
cmdSystemOrEval: finished: got output PING coba.pcpm.ucl.ac.be 
(130.104.231.12) 56(84) bytes of data.
64 bytes from coba.pcpm.ucl.ac.be (130.104.231.12): icmp_seq=1 ttl=62 
time=0.461 ms

<snip>

incr backup started back to 2008-10-01 06:00:26 (backup #277) for 
directory /etc
started incr dump, share=/etc
Running: /usr/local/bin/SSH -q -x -l root coba.pcpm.ucl.ac.be 
/usr/bin/rsync --server --sender --numeric-ids --perms --owner --group 
-D --links --times --block-size=2048 --recursive . /etc/
Xfer PIDs are now 22747
xferPids 22747
Fatal error (bad version): spawn
fileListReceive() failed
Done: 0 files, 0 bytes
Got fatal error during xfer (fileListReceive failed)


<snip>
----------------------------

the question is : is it a Perl problem or a expect problem ?

regards

jmb



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

<Prev in Thread] Current Thread [Next in Thread>