I have created a openSSH SCP bat script and scheduled task to run as SYSTEM
. I use publickkey authentication method. For that converted a private key of winscp to openSSH key using putty key gen and set permission of private key file read access only for SYSTEM
user and changed file owner too.
So when task runs it succesfully connects and works fine but sometimes its getting stuck without any error and task scheduler stuck i nrunning state.
In logs, it shows
debug1: AUthentications that can continue :publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive
debug1: Next Authentication method : publickkey
debug1:Trying private key:d:/apps/keys/prvikey
debug1: AUthentications that can continue :publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive
debug1: Next Authentication method : keyboard-interactive
debug1: read_passphrase:can't open /dev/tty:No such file or directory
After that if i go and end task scheduler process and kill any cmd.exe waiting for scp.exe PID and run again it works sometimes and failes sometimes.
Windows OS: Windows server 2012
Command used:
scp -v -i D:\apps\keys\prvikey D:\apps\file* [email protected]:\ftp\rcvfile\