On Jan 5 05:43, Andrew Schulman wrote: > > You're right, this isn't pretty. :-( Any progress since then? > > Well, I had a good idea: set up a shared (ControlMaster) ssh connection first, > in order to get the authentication out of the way, then have the sftp batch > step > use the shared connection. > > Unfortunately it seems that that idea isn't going to work, because although I > didn't know it at first, ssh shared connections don't work in Cygwin. (Unless > something has changed - no answer yet to > https://cygwin.com/ml/cygwin/2015-01/msg00010.html .)
Lots of stuff accumulated during vacation... The problem is, SSH connection sharing is implemented using local socket descriptor passing, which we don't have, sorry. > Other possible ideas: > > * Write an expect script to look for a password prompt, pass it on to the user > if it comes, otherwise go on with the batch sftp. > > * Start sftp as a bash coproc, and write bash code to look for the password > prompt in the output. I tried this a bit but again it seems that sftp > suppresses the password prompt if it detects that its stdin isn't coming from > a > TTY. What about trying to enforce a tty? sftp ... -o RequestTTY=force [...time passes...] No, that doesn't work. > Even if those ideas can be made to work, none of them is clearly better than > the > one I described before. All add complexity and depend on screen scraping. > > It's vexing that it's so hard to find a solution to such a simple problem: > prompt the user for a password if and only if one is needed. Indeed. Here's another crazy idea. - Look if ssh-agent is running (SSH_AGENT_PID non-empty?) - If not, start ssh-agent and ssh-add. This asks for the passphrase, if any. - run sftp - If the script started ssh-agent, run eval $(ssh-agent -k) Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat
pgpk7OsKDSdcH.pgp
Description: PGP signature