I'm trying to to synchronize two folders from two servers.
I'm using unison for this... I have a problem to authenticate these 2 servers.
I'm using ssh key authentication + passphrase and I have to add passphrase every time.
So I chose to use expect program like this:
Code:
#!/usr/bin/expect
set timeout 20
set folder [lindex $argv 0]
set ssh_ip [lindex $argv 1]
set passp "abcde"
apend ssh_ip $folder
spawn unison -batch "$folder $ssh_ip"
expect "Enter passphrase for key '/root/.ssh/id_rsa':"
send "$passp\r";
after executing ./sssh /folder ssh://root@192.168.1.3/
Code:
spawn unison -batch /folder ssh://root@192.168.1.3//folder
Usage: unison [options]
or unison root1 root2 [options]
or unison profilename [options]
For a list of options, type "unison -help"
For a tutorial on basic usage, type "unison -doc tutorial"
For other documentation, type "unison -doc topics"
Profile /root/.unison//foler ssh://root@192.168.1.3//folder.prf
does not exist
send: spawn id exp6 not open
while executing
"send "$passp\r""
(file ".sssh line 18")