Issues with login that requires passphrase and private key

Advertisement

pjones@mdshvac.com
Joined:
Posts:
1

Issues with login that requires passphrase and private key

I am having issues connecting using a bat file with passphrase.

This is the bat file:
cd
net use Z: \\SERVER\FOLDER
robocopy z:\ "c:\Export\FOLDER" FILE.csv /mt /z
C:\"Program Files (x86)"\WinSCP\winscp.com /script=C:\FTPScripts\FILEupload.txt
move C:\Export\FOLDER\FILE.csv C:\Export\FOLDER\BAK\
Which uses FILEupload.txt (note, in this case the passphrase is the same as the password)
option batch on
option confirm off
# Connect
open sftp://USERID:PASSWORD1@url.com -privatekey="c:\FTPScripts\FOLDER\file.ppk" -passphrase="PASSWORD1" 
# Change remote directory
cd /FOLDER/Inbox
# Upload the file from current working directory C:\Export\FOLDER\
put C:\Export\FOLDER\FILE.csv
# Exit WinSCP
close
exit
When this runs, I get this in the logfile:
23-06-09 09:51:15.096 --------------------------------------------------------------------------
. 2023-06-09 09:51:15.097 WinSCP Version 5.21.8 (Build 13000 2023-04-11) (OS 6.3.9600 - Windows Server 2012 R2 Standard)
. 2023-06-09 09:51:15.097 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2023-06-09 09:51:15.097 Log level: Normal, Logging passwords
. 2023-06-09 09:51:15.097 Local account: DOMAIN\administrator
. 2023-06-09 09:51:15.097 Working directory: C:\FTPScripts
. 2023-06-09 09:51:15.097 Process ID: 9192
. 2023-06-09 09:51:15.103 Ancestor processes: WinSCP, ...
. 2023-06-09 09:51:15.103 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=5.21.8 /consoleinstance=_2436_968 "/script=C:\FTPScripts\FILEupload.txt" 
. 2023-06-09 09:51:15.103 Time zone: Current: GMT-4, Standard: GMT-5 (Eastern Standard Time), DST: GMT-4 (Eastern Daylight Time), DST Start: 3/12/2023, DST End: 11/5/2023
. 2023-06-09 09:51:15.103 Login time: Friday, June 9, 2023 9:51:15 AM
. 2023-06-09 09:51:15.103 --------------------------------------------------------------------------
. 2023-06-09 09:51:15.103 Script: Retrospectively logging previous script records:
> 2023-06-09 09:51:15.103 Script: option batch on
< 2023-06-09 09:51:15.103 Script: batch           on        
> 2023-06-09 09:51:15.103 Script: option confirm off
< 2023-06-09 09:51:15.103 Script: confirm         off       
> 2023-06-09 09:51:15.103 Script: open sftp://USERID:PASSWORD1@url.com -privatekey="c:\FTPScripts\FOLDER\file.ppk" -passphrase="PASSWORD1" 
. 2023-06-09 09:51:15.103 --------------------------------------------------------------------------
. 2023-06-09 09:51:15.103 Session name: USERID@url.com (Ad-Hoc site)
. 2023-06-09 09:51:15.103 Host name: url.com (Port: 22)
. 2023-06-09 09:51:15.103 User name: USERID (Password: PASSWORD1, Key file: c:\FTPScripts\FOLDER\file.ppk, Passphrase: PASSWORD1)
. 2023-06-09 09:51:15.103 Tunnel: No
. 2023-06-09 09:51:15.103 Transfer Protocol: SFTP
. 2023-06-09 09:51:15.103 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2023-06-09 09:51:15.103 Disable Nagle: No
. 2023-06-09 09:51:15.103 Proxy: None
. 2023-06-09 09:51:15.103 Send buffer: 262144
. 2023-06-09 09:51:15.103 Compression: No
. 2023-06-09 09:51:15.103 Bypass authentication: No
. 2023-06-09 09:51:15.103 Try agent: Yes; Agent forwarding: No; KI: Yes; GSSAPI: Yes
. 2023-06-09 09:51:15.103 GSSAPI: KEX: No; Forwarding: No; Libs: gssapi32,sspi,custom; Custom: 
. 2023-06-09 09:51:15.103 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2023-06-09 09:51:15.103 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2023-06-09 09:51:15.103 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2023-06-09 09:51:15.103 Simple channel: Yes
. 2023-06-09 09:51:15.103 Return code variable: Autodetect; Lookup user groups: Auto
. 2023-06-09 09:51:15.103 Shell: default
. 2023-06-09 09:51:15.103 EOL: LF, UTF: Auto
. 2023-06-09 09:51:15.103 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2023-06-09 09:51:15.103 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2023-06-09 09:51:15.103 SFTP Bugs: Auto,Auto
. 2023-06-09 09:51:15.103 SFTP Server: default
. 2023-06-09 09:51:15.103 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2023-06-09 09:51:15.103 Cache directory changes: Yes, Permanent: Yes
. 2023-06-09 09:51:15.103 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2023-06-09 09:51:15.103 DST mode: Unix
. 2023-06-09 09:51:15.103 --------------------------------------------------------------------------
< 2023-06-09 09:51:15.103 Script: Searching for host...
. 2023-06-09 09:51:15.104 Looking up host "url.com" for SSH connection
. 2023-06-09 09:51:15.115 Connecting to 146.88.111.36 port 22
. 2023-06-09 09:51:15.137 Connected to 146.88.111.36
< 2023-06-09 09:51:15.138 Script: Connecting to host...
. 2023-06-09 09:51:15.138 We claim version: SSH-2.0-WinSCP_release_5.21.8
. 2023-06-09 09:51:15.138 Connected to 146.88.111.36
. 2023-06-09 09:51:15.160 Remote version: SSH-2.0-Unknown_1.0.0
. 2023-06-09 09:51:15.160 Using SSH protocol version 2
. 2023-06-09 09:51:15.162 Have a known host key of type rsa2
. 2023-06-09 09:51:15.162 Doing Diffie-Hellman group exchange
. 2023-06-09 09:51:15.266 Doing Diffie-Hellman key exchange using 4096-bit modulus and hash SHA-256 with a server-supplied group
. 2023-06-09 09:51:18.671 Server also has ssh-dss host key, but we don't know it
. 2023-06-09 09:51:18.671 Host key fingerprint is:
. 2023-06-09 09:51:18.671 ssh-rsa 2048 SHA256:v5UQK02bz7ExxJmVymsV7dU3b7togL0X2NJo11YzfbE
< 2023-06-09 09:51:18.671 Script: Authenticating...
. 2023-06-09 09:51:18.672 Host key matches cached key
. 2023-06-09 09:51:18.672 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] outbound encryption
. 2023-06-09 09:51:18.672 Initialised HMAC-SHA-256 outbound MAC algorithm
. 2023-06-09 09:51:18.672 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] inbound encryption
. 2023-06-09 09:51:18.672 Initialised HMAC-SHA-256 inbound MAC algorithm
. 2023-06-09 09:51:18.695 Reading key file "c:\FTPScripts\FOLDER\file.ppk"
! 2023-06-09 09:51:18.697 Using username "USERID".
< 2023-06-09 09:51:18.697 Script: Using username "USERID".
. 2023-06-09 09:51:18.719 Server offered these authentication methods: password,publickey
. 2023-06-09 09:51:18.719 Offered public key
. 2023-06-09 09:51:18.741 Offer of public key accepted
! 2023-06-09 09:51:18.741 Authenticating with public key "imported-openssh-key"
< 2023-06-09 09:51:18.741 Script: Authenticating with public key "imported-openssh-key".
. 2023-06-09 09:51:18.741 Prompt (passphrase, "SSH key passphrase", <no instructions>, "Passphrase for key "imported-openssh-key": ")
. 2023-06-09 09:51:18.741 Using configured passphrase.
. 2023-06-09 09:51:18.834 Sent public key signature
! 2023-06-09 09:51:18.856 Further authentication required
< 2023-06-09 09:51:18.856 Script: Further authentication required
. 2023-06-09 09:51:18.857 Further authentication required
. 2023-06-09 09:51:18.857 Server offered these authentication methods: password
. 2023-06-09 09:51:18.857 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2023-06-09 09:51:18.857 Using stored password.
< 2023-06-09 09:51:18.857 Script: Authenticating with pre-entered password.
. 2023-06-09 09:51:18.857 Sent password
. 2023-06-09 09:51:18.884 Password authentication failed
! 2023-06-09 09:51:18.884 Access denied
< 2023-06-09 09:51:18.884 Script: Access denied.
. 2023-06-09 09:51:18.885 Server offered these authentication methods: 
. 2023-06-09 09:51:18.885 No supported authentication methods available (server sent: )
. 2023-06-09 09:51:18.885 Attempt to close connection due to fatal exception:
* 2023-06-09 09:51:18.885 No supported authentication methods available (server sent: )
. 2023-06-09 09:51:18.885 Closing connection.
< 2023-06-09 09:51:18.885 Script: No supported authentication methods available (server sent: )
< 2023-06-09 09:51:18.885 Authentication log (see session log for details):
< 2023-06-09 09:51:18.886 Using username "USERID".
< 2023-06-09 09:51:18.886 Authenticating with public key "imported-openssh-key".
< 2023-06-09 09:51:18.886 Further authentication required
< 2023-06-09 09:51:18.886 Access denied.
< 2023-06-09 09:51:18.886 
 
< 2023-06-09 09:51:18.886 Authentication failed.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,034
Location:
Prague, Czechia

Re: Issues with login that requires passphrase and private key

Can you authenticate anyhow? In WinSCP GUI? In any other SFTP client? If you can, post its log file.

Reply with quote

Advertisement

You can post new topics in this forum