rsync - Expect Tcl script - Error passing quoted argument using spawn -


I just wrote a script that is very easy to wrap around rsync, but it looks like I'm having trouble . Actually, I am automating the SSH login prompt which is called from rsync. I would also have to argue for SSH through RSIINC so that the host key could not be checked. I know very well about SSH certification keys and SSH-Cage, but I have good reason to talk like this so that there is no lecture on passing the passwords on the command line.

script


  #! / Usr / local / bin / expect -f if {$ argc! = 5} {"Usage: RemoteCopy {Remotehost, Username, Password, Local File, Remote}" Set Out Set Remote Host Set [Lindex $ argv 0] Set Username [lindex $ argv 1] Set Password [lindex $ Argv 2] ​​Set local file [lindex $ argv 3] Remotek set [lindex $ argv 4] set timeout -1 spawn rsync -e \ "ssh -q -o StrictHostKecking = any \" $ localfile $ username $ $ remotehost: Expecting $ remotlel "password"; The complete output from the script is here:  

Output
  click on avoelker @ "$ password \ r"  

Localhost $ ./remoteFileCopy.tcl remotehost Remoter remotepass ~ / localfile / tmp / spawn rsync -e "ssh -q -o hardhostic checking = no" / localhost / home / avoelker / localfile Remotusor @ remotehost: / tmp / rsync: failing Exec "Ssh: such a file or directory (2) rsync error: error in IPC code (code 14) on pipe.c (83) rsync: connection closed unexpectedly (0 bytes so far) [sender] rsync error Send the error protocol data stream (code 12) to io.c (434) in rsync: the spawn id is not open to send the "password" to the exp6 to "password" (file "./remoteFileCopy.tcl" 17) avoelker @ localhost $

It seems that rsync is trying to execute "ssh instead of ssh Still, copying and pasting the first line of production is expected from the studio ( rsync -e "ssh -q -o hardhostki checking = no" / localhost / Home / avoelker / localf IL Remover @ RemoteHost: / TMP / ) works right in the shell, so I know that it is not a problem with rsync.

When I delete the -e argument altogether, the spawn rsync line executes the expected script without errors, but I have to add the script to the check for the host key , Which I do not want to do.

Is there any other hope / experience with TCL that what am I doing?

Drop your backslash spawn line should just say:

  spawn rsync -e "ssh -q -o StrictHostKeyChecking = no" $ localfile $ username @ $ remotehost: $ remoteloc  

After all, you rsync Do not want to see an order with a quote in it, do you?


Comments