Script fails with "Access Denied" but can connect successfully with GUI

Advertisement

GoldenTaco
Guest

Script fails with "Access Denied" but can connect successfully with GUI

As the subject says, I can connect successfully with the vendor provided credentials when using the GUI, but cannot with the script.

Log file is as follows;

. 2015-09-24 15:21:04.048 --------------------------------------------------------------------------
. 2015-09-24 15:21:04.048 WinSCP Version 5.7.5 (Build 5665) (OS 6.1.7601 Service Pack 1 - Windows Server 2008 R2 Enterprise)
. 2015-09-24 15:21:04.048 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2015-09-24 15:21:04.048 Log level: Normal
. 2015-09-24 15:21:04.048 Local account: ###\########
. 2015-09-24 15:21:04.048 Working directory: C:\Company
. 2015-09-24 15:21:04.048 Process ID: 5496
. 2015-09-24 15:21:04.048 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=575 /consoleinstance=_2684_371 "/script=test.txt" "/log=sftpautomate.log"
. 2015-09-24 15:21:04.048 Time zone: Current: GMT-5, Standard: GMT-6 (Central Standard Time), DST: GMT-5 (Central Daylight Time), DST Start: 3/8/2015, DST End: 11/1/2015
. 2015-09-24 15:21:04.048 Login time: Thursday, September 24, 2015 3:21:04 PM
. 2015-09-24 15:21:04.048 --------------------------------------------------------------------------
. 2015-09-24 15:21:04.048 Script: Retrospectively logging previous script records:
> 2015-09-24 15:21:04.048 Script: option batch abort
< 2015-09-24 15:21:04.048 Script: batch abort
< 2015-09-24 15:21:04.048 Script: reconnecttime 120
> 2015-09-24 15:21:04.048 Script: option confirm off
< 2015-09-24 15:21:04.048 Script: confirm off
> 2015-09-24 15:21:04.048 Script: open sftp://#######:***@sftp.company.com
. 2015-09-24 15:21:04.048 --------------------------------------------------------------------------
. 2015-09-24 15:21:04.048 Session name: 55a912c7e4b0748b5a753057@sftp.pifdata.net (Ad-Hoc site)
. 2015-09-24 15:21:04.048 Host name: sftp.company.com (Port: 22)
. 2015-09-24 15:21:04.048 User name: ######## (Password: Yes, Key file: No)
. 2015-09-24 15:21:04.048 Tunnel: No
. 2015-09-24 15:21:04.048 Transfer Protocol: SFTP
. 2015-09-24 15:21:04.048 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2015-09-24 15:21:04.048 Disable Nagle: No
. 2015-09-24 15:21:04.048 Proxy: none
. 2015-09-24 15:21:04.048 Send buffer: 262144
. 2015-09-24 15:21:04.048 SSH protocol version: 2; Compression: No
. 2015-09-24 15:21:04.048 Bypass authentication: No
. 2015-09-24 15:21:04.048 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2015-09-24 15:21:04.048 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2015-09-24 15:21:04.048 KEX: dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN
. 2015-09-24 15:21:04.048 SSH Bugs: A,A,A,A,A,A,A,A,A,A,A,A
. 2015-09-24 15:21:04.048 Simple channel: Yes
. 2015-09-24 15:21:04.048 Return code variable: Autodetect; Lookup user groups: A
. 2015-09-24 15:21:04.048 Shell: default
. 2015-09-24 15:21:04.048 EOL: 0, UTF: 2
. 2015-09-24 15:21:04.048 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2015-09-24 15:21:04.048 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2015-09-24 15:21:04.048 SFTP Bugs: A,A
. 2015-09-24 15:21:04.048 SFTP Server: default
. 2015-09-24 15:21:04.048 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2015-09-24 15:21:04.048 Cache directory changes: Yes, Permanent: Yes
. 2015-09-24 15:21:04.048 DST mode: 1
. 2015-09-24 15:21:04.048 --------------------------------------------------------------------------
. 2015-09-24 15:21:04.079 Looking up host "sftp.company.com"
. 2015-09-24 15:21:04.220 Connecting to xx.xx.xx.xx port 22
. 2015-09-24 15:21:04.376 Server version: SSH-2.0-SSHD-CORE-0.14.0
. 2015-09-24 15:21:04.376 Using SSH protocol version 2
. 2015-09-24 15:21:04.376 We claim version: SSH-2.0-WinSCP_release_5.7.5
. 2015-09-24 15:21:04.454 Doing Diffie-Hellman group exchange
. 2015-09-24 15:21:05.062 Doing Diffie-Hellman key exchange with hash SHA-256
. 2015-09-24 15:21:07.262 Verifying host key rsa2 0x10001,0xa08f54686dd4c448 bc8e54a41ab022f1 629d0a3cba49dfab cac196c1aa94b8e3 97adf7333a1d36a1 ccc17e5cbaeebe1f cdc041d419cefdbb 349322f3a805b373 c737b16a9ed63797 fc6e5d584a8e59ef f9a4a602a01ea011 b0aa7fdbe776265f 4417f872555d8d9a 3b9dec9460a8999d 78a5cce183d7f796 e54480002708ea78 780f27c7be835271 e1b98bd98dd86e11 cda6bbf0751013f8 7e5bfcaf6577628b f2a3690acf54f406 50690cc06d933a60 689ebf16c132522b dc7af20129500d8d 0996e19b9f797b80 c471f7130633dde4 831a3b1f0fcd2f8e 5da7730ef10ed14a 70513a6e52d5a080 4b4df639c5e50f24 667c0e8142511a72 1ebf652ab3a73d8d with fingerprint ssh-rsa 2048 4c:fd:9f:b0:7d:be:43:a9:18:da:6a:5c:d5:94:4f:37
. 2015-09-24 15:21:07.262 Host key matches cached key
. 2015-09-24 15:21:07.262 Host key fingerprint is:
. 2015-09-24 15:21:07.262 ssh-rsa 2048 4c:fd:9f:b0:7d:be:43:a9:18:da:6a:5c:d5:94:4f:37
. 2015-09-24 15:21:07.262 Initialised AES-256 SDCTR client->server encryption
. 2015-09-24 15:21:07.262 Initialised HMAC-SHA-256 client->server MAC algorithm
. 2015-09-24 15:21:07.262 Initialised AES-256 SDCTR server->client encryption
. 2015-09-24 15:21:07.262 Initialised HMAC-SHA-256 server->client MAC algorithm
! 2015-09-24 15:21:07.418 Using username "#########".
. 2015-09-24 15:21:07.496 Attempting keyboard-interactive authentication
. 2015-09-24 15:21:07.574 Prompt (keyboard interactive, "SSH server: Password authentication", "Using keyboard-interactive authentication.", "Password: ")
. 2015-09-24 15:21:07.574 Using stored password.
. 2015-09-24 15:21:07.667 Keyboard-interactive authentication failed
! 2015-09-24 15:21:07.667 Access denied
. 2015-09-24 15:21:07.667 Attempting keyboard-interactive authentication
. 2015-09-24 15:21:07.730 Prompt (keyboard interactive, "SSH server: Password authentication", "Using keyboard-interactive authentication.", "Password: ")
. 2015-09-24 15:21:07.730 Disconnected: Unable to authenticate

Reply with quote

Advertisement

LL
Guest

Script fails with "Access Denied" but can connect successfully with GUI

Hello!

Problem is in Your password, it contains no-ascii letters. You can change Your pass to ascii letters password or have to convert non ascii letters to hex and prefix them by %
Seems WinScP could not accept non-ascii options. :)

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Script fails with "Access Denied" but can connect successfully with GUI

LL wrote:

Seems WinScP could not accept non-ascii options. :)
Well, that's not true.

Anyway, your hint maybe valid, but for special symbols, not non-ascii characters.
https://winscp.net/eng/docs/session_url#special

I'd suggest to enable password logging (/loglevel=*) and inspect the log file, if a correct password is used.

See also https://winscp.net/eng/docs/faq_script_vs_gui

Reply with quote

GoldenTaco
Guest

It was the special characters in the password.

I had them re-generate the password without them and it works now.

Thanks, LL!

Reply with quote

Advertisement

You can post new topics in this forum