I am creating a script file programmatically and call psftp.exe
as follows:
psftp [email protected] -pw password -b psftpscript.txt
but it prompts for user input
The server's host key is not cached in the registry. You have no guarantee that the server is the computer you think it is. The server's rsa2 key fingerprint is: [ssh-rsa 1024 somekey] If you trust this host, enter "y" to add the key to PuTTY's cache and carry on connecting. If you want to carry on connecting just once, without adding the key to the cache, enter "n". If you do not trust this host, press Return to abandon the connection. Store key in cache? (y/n)
I need it to be completely prompt free, automatic. I tried -batch parameter but it just abandons the connection
PSFTP allows you to run an interactive file transfer session, much like the Windows ftp program. You can list the contents of directories, browse around the file system, issue multiple get and put commands, and eventually log out.
Below are three ways to open PSFTP: Click on the Windows Start button and go to 'All Programs. ' From the list of program, Click on PuTTY and then PSFTP. The second option is to enter the following path in the address bar – “C:\Program Files (x86)\PuTTY” and then double-click on psftp.exe.
PuTTY records the host key for each server you connect to, in the Windows Registry. Every time you connect to a server, it checks that the host key presented by the server is the same host key as it was the last time you connected.
I had the same problem with running a unattended script in Windows Server 2008's 'sandbox' like environment. I ended up running the following which enters the y
at the prompt for you:
echo y | psftp [email protected] -l username -pw password -b psftpscript.txt
Hope this helps!
Note: I only had to run the echo y once and removing it for the 2nd run didn't ask for the key to be cached anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With