Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

damien

Problem solved!

Hi @martin, you have solved a problem on which I was stuck from several days.
I am astonished by your competence and experience.
Your support is really precious, I am grateful to you.
martin

Re: Host key does not match configured key ssh-rsa

If the account is chrooted, you have to use a path relative to the root.

I assume that if you login (in GUI), you do not start in /home/timbr, but in / (what is physically the /home/timbr). So in the script you also need to use a path starting from /, not /home/timbr. I.e. probably /timbrature/ (but I obviously do not know what your root is, so it's just a guess).

See https://winscp.net/eng/docs/faq_script_vs_gui#paths
Guest

Re: Host key does not match configured key ssh-rsa

Thanks a lot @martin, 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.
damien

Host key does not match configured key ssh-rsa

I can connect successfully to my Linux server using WinSCP GUI version 5.5.1 under Windows 7.
However I need to automate a few file transfers so I have to use WinSCP from command line (MSDOS style).
The structure of my command file is the following:
WinSCP.exe /log=ftpcmd.log /command "option confirm off" "option batch continue" ^
    "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"" ^
    "put d:\timbrature\ 20140516.csv /home/timbr/timbrature/" ^
    "exit"

In this example I put <user> <passw> and <hostname> in place of the real username, password and host names.

The auto-confirmation fails with the following messages:

Host key does not match configured key ssh-rsa.
Asking user:
**Continue connecting to an unknown server and add its host key to a cache?**
The server's host key was not found in the cache. You have no guarantee that the server is the computer you think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 b7:d7:c0:65:a8:5e:a1:ef:11:91:db:98:3d:92:2a:2a
If you trust this host, press Yes. To connect without adding host key to the cache, press No. To abandon the connection press Cancel. ()
Attempt to close connection due to fatal exception:
Host key fingerprint is ssh-rsa 2048 b7:d7:c0:65:a8:5e:a1:ef:11:91:db:98:3d:92:2a:2a.
(Exception) Host key wasn't verified!
Closing connection.
Sending special code: 12

I double checked the host key in the server boot data and it is correct and matches with the one which appears in the above log file.

For debugging purpose I tried to use -hostkey="*” and it works. I can't understand what is wrong with the auto-confirmation.
Can someone help?
Thank you.