Topic "Authentication failed."

Author Message
walkerk
[View user's profile]

Joined: 2015-06-26
Posts: 3
Having trouble with signing on to sftp site. getting an Authentication failed
my password is structured pwd$$ does having $$ in the password be source of the problem?


# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect
open sftp://username:password$$@website.com/ -hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
# Change remote directory
cd /compliance
# Force binary mode transfer
option transfer binary
# Download file to the local directory C:\ChatTest
get x_20*.xml C:\ChatTest
# Disconnect
close


getting the following error

C:\Program Files (x86)\WinSCP>winscp.com /script=c:\IceChat_script.txt
batch abort
reconnecttime 120
confirm off
Searching for host...
Connecting to host...
Authenticating...
Using username "svc-mt-y".
Authenticating with pre-entered password.
Access denied.
Connection has been unexpectedly closed. Server sent command exit status 0.
Authentication log (see session log for details):
Using username "svc-mft-yjxcelenergy".
Access denied.

Authentication failed.
Advertisements
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26911
Location: Prague, Czechia
The $$ should not be a problem. Can you connect with GUI?
walkerk
[View user's profile]

Joined: 2015-06-26
Posts: 3
martin wrote:
The $$ should not be a problem. Can you connect with GUI?


i can connect using the full gui application
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26911
Location: Prague, Czechia
Enable password logging and compare the password in GUI and scripting session.
https://winscp.net/eng/docs/ui_pref_logging
walkerk
[View user's profile]

Joined: 2015-06-26
Posts: 3
I logged the steps from the GUI screen and i notice the following
what is the syntex for handing Private key and "SSH key passphrase"


Reading private key file "C:\WinSCP\ICE Notes\ICEPrieKey.ppk"
! 2015-07-21 15:37:51.690 Using username "svc-mft-yjxcelenergy".
. 2015-07-21 15:37:52.818 Offered public key
. 2015-07-21 15:37:52.833 Offer of public key accepted
! 2015-07-21 15:37:52.833 Authenticating with public key "rsa-key-2015XXXX"
. 2015-07-21 15:37:52.880 Prompt (passphrase, "SSH key passphrase", <no instructions>, "Passphrase for key "rsa-key-2015XXXX": ")
. 2015-07-21 15:37:56.338 Sent public key signature
. 2015-07-21 15:37:56.369 Access granted
. 2015-07-21 15:37:56.369 Opening session as main channel
. 2015-07-21 15:37:56.385 Opened main channel
. 2015-07-21 15:37:56.478 Started a shell/command
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26911
Location: Prague, Czechia
So are you authentication with password or private key (encrypted with a passphrase)?

If with private key encrypted with a passphrase, use -passphrase= switch:
https://winscp.net/eng/docs/scriptcommand_open
Mey

Guest


Hi, I am in a similar situation mentioned in the thread below. While authenticating using command line option, it fails Authentication. Same password is fine using interactive Logon using WinSCP (I did a paste of the same password) as well as it is fine in GUI.

But when we include the script in command line option then the authentication fails. When Log was enabled, it was noticed that the character + in the password was replaced with a space. I tried placing the character as %43 with its ASCII code but that failed too.

Any idea how to succeed through the authentication process?

Any help is much appreciated.
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26911
Location: Prague, Czechia
Mey wrote:
Hi, I am in a similar situation mentioned in the thread below. While authenticating using command line option, it fails Authentication. Same password is fine using interactive Logon using WinSCP (I did a paste of the same password) as well as it is fine in GUI.

But when we include the script in command line option then the authentication fails. When Log was enabled, it was noticed that the character + in the password was replaced with a space. I tried placing the character as %43 with its ASCII code but that failed too.

Any idea how to succeed through the authentication process?

Please read https://winscp.net/eng/docs/faq_script_vs_gui
Guest






Hi Martin,

That has worked wonderfully well. I noticed that the special characters are mentioned with the Hex equivalent where as I have been trying with decimal ones. The automatic generation of script is a very handy feature of the application. Thanks to the developers and Thank you very much for the support.
umair.tariq

Guest


Hi,

I'm facing below error while using WinSCP assembly in my c# code

Connection has been unexpectedly closed. Server sent command exit status 0.
Authentication log (see session log for details):
Unable to use key file "PuTTY-User-Key-File-2: ssh-rsa
Encryption: aes256-cbc
Comment: rsa-key-20160909
Public-Lines: 6
AAAAB3NzaC1yc2EAAAABJQAAAQEA3vMOJJOGCZP+HrFLiWpuLG" (unable to open file)
Using username "m79971".

Authentication failed.

Attaching my code snippet.


Your quick response on this will be highly appreciated. Thanks in advance.
CodeSnippetWinSCP.PNG (11.75 KB)

Description: Code Snippet...

CodeSnippetWinSCP.PNG

martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26911
Location: Prague, Czechia
The $$ should not be a problem.

Can you login in WinSCP GUI or using any other SFTP/SSH client?
umair.tariq

Guest


Yes I'm able to login successfully from GUI.
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26911
Location: Prague, Czechia
umair.tariq wrote:
Yes I'm able to login successfully from GUI.

So enable password logging and check both GUI and script log for an actual password being used.
GUI: https://winscp.net/eng/docs/ui_pref_logging
Script: Use /loglevel=*
somebadhat

Guest


SOLVED MY SPECIAL CHARACTER PROBLEM BY TURNING OFF setlocal ENABLEDELAYEDEXPANSION IN THE BATCH FILE. I HAVE ! IN THE PASSWORD.
somebadhat

Guest


THANKS MARTIN.
john pena

Guest


Hi
I am unable to log in using the script. However using same username and password I can successfully log in. Thanks for the help.



C:ftp_work>winscp.com /script=my_script.txt /log=my_log.log
Searching for host...
Connecting to host...
Authenticating...
Using username "userxxx".
Authenticating with pre-entered password.
Using keyboard-interactive authentication.


xxxx Session Broker 9.1.2.1

...
....
...

Connection has been unexpectedly closed. Server sent command exit status 0.
Authentication log (see session log for details):
Using username "userxxx".

Authentication failed.

C:ftp_work>



----------------------------------
my_script.txt
----------------------------------
open sftp://userxxx:secret@xx.xx.xxx.xx:8024/ -rawsettings ProxyMethod=1 ProxyHost=localhost ProxyPort=2015
cd /dir1/dir2
get file1
bye




----------------------------------
my_log.log
----------------------------------
....
. 2017-07-12 18:05:59.293 Initialised AES-256 SDCTR client->server encryption
. 2017-07-12 18:05:59.293 Initialised HMAC-SHA1 client->server MAC algorithm
. 2017-07-12 18:05:59.293 Initialised AES-256 SDCTR server->client encryption
. 2017-07-12 18:05:59.293 Initialised HMAC-SHA1 server->client MAC algorithm
! 2017-07-12 18:05:59.293 Using username "userxxx".
. 2017-07-12 18:05:59.308 Server offered these authentication methods: password,keyboard-interactive
. 2017-07-12 18:05:59.308 Attempting keyboard-interactive authentication
. 2017-07-12 18:05:59.308 Prompt (keyboard interactive, "SSH server authentication", "Using keyboard-interactive authentication.", "Password: ")
. 2017-07-12 18:05:59.308 Using stored password.
. 2017-07-12 18:06:01.732 Prompt (keyboard interactive, "SSH server authentication", "Using keyboard-interactive authentication.
. 2017-07-12 18:06:01.732

. 2017-07-12 18:06:01.732

. 2017-07-12 18:06:01.732 xxxx Session Broker 9.1.2.1

. 2017-07-12 18:06:01.732

. 2017-07-12 18:06:01.732 This system is private and may only be accessed if authorized.

. 2017-07-12 18:06:01.732 ", <no prompt>)
. 2017-07-12 18:06:02.237 Prompt (keyboard interactive, "SSH server authentication", "Using keyboard-interactive authentication.", "networkId: ")
. 2017-07-12 18:06:02.237 Disconnected: Unable to authenticate
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26911
Location: Prague, Czechia
john pena wrote:
Hi
I am unable to log in using the script. However using same username and password I can successfully log in. Thanks for the help.

Please start a new thread and attach full session log files both from script and GUI (using the latest version of WinSCP).
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