Authentication Failed

Advertisement

suprit1289
Guest

Authentication Failed

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.

Description: winscp version

winscp.PNG

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: Authentication Failed

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.

Reply with quote

suprit1289
Guest

Re: Authentication Failed

martin 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.

Reply with quote

suprit1289
Guest

Re: Authentication Failed

martin 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,

Reply with quote

Advertisement

You can post new topics in this forum