Topic "Unable to authenticate SFTP Credentials using Batch Script"

Author Message
sundar2013
[View user's profile]

Joined: 2016-04-04
Posts: 8
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.
winscp.log (4.65 KB) [Download]

Description: (none)

Advertisements
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27106
Location: Prague, Czechia
Please attach a log file from GUI for comparison.

You also better use the latest version of WinSCP.
sundar2013
[View user's profile]

Joined: 2016-04-04
Posts: 8
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

sundar2013
[View user's profile]

Joined: 2016-04-04
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.
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27106
Location: Prague, Czechia
Thanks for your feedback.
Piyush

Guest


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
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27106
Location: Prague, Czechia
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
Piyush

Guest


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
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27106
Location: Prague, Czechia
Please start a new thread and post a complete log file and your script/batch file.
Advertisements

You can post new topics in this forum

Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License