Topic "Authentication Failed"

Author Message
suprit1289

Guest


I am trying to automate using batch script to upload files to sftp directory. On the winscp GUI I have enter the credentials and I can successfully log on to the sftp directory. However when I try to connect to same sftp directory with same login credentials using winscp.com on command prompt i am getting an authentication error. This is just for testing to make my automate script work.

automate script works this way.
Batch file
date /T >>e:\log\transfer_sig-log.txt
@echo %username% >>e:\log\transfer_sig-log.txt
date /T >>e:\log\transfer_sig-log.txt
time /T >>e:\log\transfer_sig-log.txt
"C:\Program Files (x86)\WinSCP\WinSCP.com" /script=E:\SQL-Transfer\TransferSigFile.txt >>e:\log\transfer_sig-log.txt


transfer_sig-log.txt file


option batch on

option confirm off

open sftp://user_name:password@example.com:port -hostkey="ssh-dss 1024 34:23:z1:d2:c1:1c:41:76:5r:2d:e9:v9:34:q2:w9:12"

put E:\local_directory /sftp_directory

exit


Below is the error I am getting using above automated script

Authenticating with pre-entered password.
Host is not communicating for more than 15 seconds. Still waiting...
Note: If the problem repeats, try turning off 'Optimize connection buffer size'.
Warning: Aborting this operation will close connection!
(A)bort (60 s):
Access denied.
Connection has been unexpectedly closed. Server sent command exit status 0.
Authentication log (see session log for details):
Using username "user_name".
Access denied.


Authentication failed.
No session.
No session.

Please help ASAP thank you.
winscp.PNG (10.35 KB)

Description: winscp version

winscp.PNG

Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
Please attach log files both from the GUI and the script, showing the different behavior.
Make sure you use the latest version of WinSCP for the test.
suprit1289

Guest


prikryl wrote:
Please attach log files both from the GUI and the script, showing the different behavior.
Make sure you use the latest version of WinSCP for the test.


Thank you for your fast response. I have troubleshoot this issue and found the solution. The issue was password has special characters and I have replaced it with hexadecimal and it worked like a charm.
The other mistake was in the script I have put space between hostkey and equal sign. that was also an issue.
Eg -hostkey = "12:2a:12:23.......: The space in between was also an issue.
suprit1289

Guest


prikryl wrote:
Please attach log files both from the GUI and the script, showing the different behavior.
Make sure you use the latest version of WinSCP for the test.


Hi,

I need some help. My password contains some of the special characters like
&$%}]@*

How do I verify the connection to sftp using winscp.com
it works using GUI.

Thank you,
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
suprit1289 wrote:
I need some help. My password contains some of the special characters like
&$%}]@*

What help? You already know for to URL-encode them, right?
https://winscp.net/eng/docs/session_url#special
Advertisements

You can post new topics in this forum






Search Site

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