martin wrote:
You have the quotes wrong.
It should be:
"open sftp://<user>:<passw> @ftp.<hostname> -hostkey=""ssh-rsa 2048 b7:d7:c0:65:a8:5e:a1:ef:11:91:db:98:3d:92:2a:2a""" ^
See
https://winscp.net/eng/docs/commandline#syntax
------------------------------------------------------------------
Thanks a lot prikryl, the problem was exactly due to the wrong quotes and now the host key matches the configured key.
The script is now this:
WinSCP.exe /log=ftpcmd.log /command "option confirm off" "option batch continue" ^
"open sftp://timbr:hrassist8105@ftp.sanmarcoinformatica-xa2f.hr-assistant.it -hostkey=""ssh-rsa 2048 b7:d7:c0:65:a8:5e:a1:ef:11:91:db:98:3d:92:2a:2a""" ^
"put d:\timbrature\timb_roma-20140516.csv /home/timbr/timbrature/" ^
"exit"
I have still a problem in uploading the file as I get these error messages:
SSH_FXP_OPEN, Size: 70, Number: 259
Type: SSH_FXP_STATUS, Size: 29, Number: 259
Status code: 2, Message: 259, Server: No such file, Language:
Type: SSH_FXP_LSTAT, Size: 54, Number: 519
SSH_FXP_STATUS, Size: 29, Number: 519
Status code: 2, Message: 519, Server: No such file, Language:
(ETerminal) No such file or directory.
Error code: 2
Error message from server: No such file
The transfer occurs in a jailed folder. I have configured as suggested in
https://askubuntu.com/questions/280894/changing-write-permissions-for-jailed-sftp-denies-login
The user is jailed to /home/timbr/. I chown root:filetransfer /home/timbr/ where filetransfer is the group to which the user timbr belongs. I then created another folder /home/timbr/timbrature/. I chown timbr:timbr /home/timbr/timbrature/ as well as chmod 775 /timbr/timbr/timbrature/
Again from the GUI interface I can login as timbr and upload files to home/timbr/timbrature while in the batch execution I get the above errors.
I enclose the new log file.
Thanks again for your help.