Unable to authenticate SFTP Credentials using Batch Script

Advertisement

sundar2013
Joined:
Posts:
8

Unable to authenticate SFTP Credentials using Batch Script

WINSCP - Version 5.12
Version of Windows - Windows 7
Transfer Protocol - SFTP
Error : Disconnected: Unable to authenticate

I am connecting SFTP Server using username and password directly in the batch script, but it is not working. I am not using host key and I am using the password directly.

I able to connect to my SFTP server using Graphical user interface with same credentials.

The Batch Script is mentioned below.

option batch abort
option confirm off
open sftp://username:password@Server Name
exit

Password had characters like +-. I don't know this will cause the issue.

Error :

. 2016-05-13 14:39:02.283 Using stored password.
! 2016-05-13 14:39:02.315 Further authentication required
. 2016-05-13 14:39:02.316 Further authentication required
. 2016-05-13 14:39:02.318 Attempting keyboard-interactive authentication
. 2016-05-13 14:39:02.347 Prompt (6, SSH server authentication, Using keyboard-interactive authentication., Enter password: )
. 2016-05-13 14:39:02.349 Disconnected: Unable to authenticate

Please help me to resolve it.

Thanks.
Sundaramurthy J.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Unable to authenticate SFTP Credentials using Batch Script

Please attach a log file from GUI for comparison.

You also better use the latest version of WinSCP.

Reply with quote

sundar2013
Joined:
Posts:
8

Unable to authenticate SFTP Credentials using Batch Script

Hi,

Herewith I am attaching the log file from GUI WINSCP.

From GUI if I enter the password directly it is asking for the password again & again during authentication. If I check the option to save the password then it won't ask and started working in GUI.

I am doubting that through script password is not storing correctly.

Please help me.

Regards,
Sundaramurthy J.
  • Winscp _GUI.log (6.77 KB, Private file)
Description: GUI Log File for Comparision

Reply with quote

sundar2013
Joined:
Posts:
8

Hi,

I have resolved the issue. Password has special characters that caused the problem. I have converted special characters to Hexa that solved the problem.

Thanks for your help.

Regards,
Sundaramurthy J.

Reply with quote

Advertisement

Piyush
Guest

Further Authentcation Issue

Hi,
I am facing same issue of authenication failure, log data as under

Host key matches configured key
. 2017-03-09 19:14:13.555 Initialised AES-256 SDCTR client->server encryption
. 2017-03-09 19:14:13.555 Initialised HMAC-SHA1 client->server MAC algorithm
. 2017-03-09 19:14:13.555 Initialised AES-256 SDCTR server->client encryption
. 2017-03-09 19:14:13.555 Initialised HMAC-SHA1 server->client MAC algorithm
. 2017-03-09 19:14:13.793 Reading key file "C:\HDFCC\Private Key.ppk"
! 2017-03-09 19:14:13.794 Using username "CHDFCJYOTHY".
. 2017-03-09 19:14:13.804 Server offered these authentication methods: password,publickey,keyboard-interactive
. 2017-03-09 19:14:13.804 Offered public key
. 2017-03-09 19:14:13.812 Offer of public key accepted
! 2017-03-09 19:14:13.812 Authenticating with public key "rsa-key-xxxxxxxxxxx"
. 2017-03-09 19:14:13.854 Sent public key signature
! 2017-03-09 19:14:13.863 Further authentication required
. 2017-03-09 19:14:13.863 Further authentication required
. 2017-03-09 19:14:13.863 Server offered these authentication methods: password,keyboard-interactiveÝئJ––C á‹èqà’¥c4 ð‚ðÇ
. 2017-03-09 19:14:13.864 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2017-03-09 19:14:13.864 Using stored password.
. 2017-03-09 19:14:13.864 Sent password
! 2017-03-09 19:14:13.881 Further authentication required
. 2017-03-09 19:14:13.881 Further authentication required
. 2017-03-09 19:14:13.881 Server offered these authentication methods: password,keyboard-interactive·*Ã
nb.’°`1ÚÂï#Z°ðšµä•MŠ“±È
. 2017-03-09 19:14:13.881 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2017-03-09 19:14:13.881 Disconnected: Unable to authenticate



Refer to above problem have found it is because of special charater in password, the issue that the policy doesn't accept password without special characters and I am stuck up because I cannot automate the download process and needs manual intervention to download the file. I am using latest version of WinScp
Pl. advice

Thanks

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Further Authentcation Issue

Piyush wrote:

Refer to above problem have found it is because of special charater in password, the issue that the policy doesn't accept password without special characters and I am stuck up because I cannot automate the download process and needs manual intervention to download the file. I am using latest version of WinScp
Why do you think the problem is because of a special character in the password?
Anyway, did you try to URL-encode it?
https://winscp.net/eng/docs/session_url#special

Reply with quote

Piyush
Guest

Further Authentcation Issue

Hi , thanks for your suggestion, however I am novice for it, I only know BAT file scripting, I tried using URL, pl. advice how to execute it,i tried using command line and code that generated by winscp through URL, it says ssh key not valid.

. 2017-03-14 15:01:52.848 Host key does not match configured key "ssh-rsa
. 2017-03-14 15:01:52.848 Attempt to close connection due to fatal exception:
* 2017-03-14 15:01:52.848 Host key fingerprint is ssh-rsa 2048 *************
* 2017-03-14 15:01:52.848 (Exception) **Host key does not match configured key ""ssh-rsa"!**
. 2017-03-14 15:01:52.848 Closing connection.
. 2017-03-14 15:01:52.848 Sending special code: 12


Thanks
Piyush

Reply with quote

martin
Site Admin
martin avatar

Re: Further Authentcation Issue

Please start a new thread and post a complete log file and your script/batch file.

Reply with quote

Advertisement

You can post new topics in this forum