powershellproxysftpwinscp-net

Proxy error: Unable to parse auth header from HTTP proxy: authentication type 'NTLM' not supported"


I am using a batch script to download files from an SFTP server over the Internet. The script is running on a VM which is behind a corporate proxy.

When I am logged in to the SFTP server via WinSCP, the script runs fine but when I am running the script by itself, I get the error: Proxy error: Unable to parse auth header from HTTP proxy: authentication type 'NTLM' not supported"

What am I doing wrong?

Here is a snippet of the script:

Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll"

$Source = "E:\somepath\"
$username = "someusername"
$password = "somep@ssw0rd"
$pair = "$($username):$($password)"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$basicAuthValue = "Basic $encodedCreds"

$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
    Protocol = [WinSCP.Protocol]::Sftp
    HostName = "11.222.333.44"
    PortNumber = 5567
    UserName = "sftpusername"
    Password = "sftppassw0rd"
    SshHostKeyFingerprint = "ssh-ed25519 255 DHhI/5fErnTc1txlbYDeBkRuhWkIMJl6axQRj4t/Xjy"
}

$sessionOptions.AddRawSettings("ProxyMethod", "3")
$sessionOptions.AddRawSettings("ProxyHost", "10.26.46.92")
$sessionOptions.AddRawSettings("ProxyPort", "8080")
$sessionOptions.AddRawSettings("Authorization", $basicAuthValue)

$session = New-Object WinSCP.Session

try
{
    # Connect
    $session.Open($sessionOptions)

    # Transfer files
    $session.GetFiles("/sftppath/"+$timestamp, $Source).Check()
}
finally
{
    $session.Dispose()
}

I tried passing the username and password instead of the authorization token but got the same issue.

I tried making this in Python using paramiko but getting stuck there as well.

Update 1: Removed as it is not required Update 2: Removed as it is not required

Update 3: Here is the session log file generated using Session.SessionLogPath

. 

2024-07-21 19:30:01.290 --------------------------------------------------------------------------
. 2024-07-21 19:30:01.290 WinSCP Version 5.21.1 (Build 12643 2022-06-24) (OS 10.0.17763 - Windows Server 2019 Standard)
. 2024-07-21 19:30:01.290 Configuration: nul
. 2024-07-21 19:30:01.290 Log level: Normal
. 2024-07-21 19:30:01.290 Local account: somedomain\someuser
. 2024-07-21 19:30:01.290 Working directory: C:\Program Files (x86)\WinSCP
. 2024-07-21 19:30:01.290 Process ID: 9272
. 2024-07-21 19:30:01.305 Ancestor processes: powershell, svchost, ...
. 2024-07-21 19:30:01.305 Command-line: "C:\Program Files (x86)\WinSCP\winscp.exe" /xmllog="C:\Users\someuser\AppData\Local\Temp\wscp2D1C.00216C05.tmp" /xmlgroups /xmllogrequired /nointeractiveinput /stdout /stdin /dotnet=5.21.1  /ini=nul /log="D:\Schedulers\Powershell\BSEScriptSession21072024.log"  /console /consoleinstance=_11548_31456487_964
. 2024-07-21 19:30:01.305 Time zone: Current: GMT+5:30 (India Standard Time), No DST
. 2024-07-21 19:30:01.305 Login time: 21 July 2024 19:30:01
. 2024-07-21 19:30:01.305 --------------------------------------------------------------------------
. 2024-07-21 19:30:01.305 Script: Retrospectively logging previous script records:
> 2024-07-21 19:30:01.305 Script: option batch on
< 2024-07-21 19:30:01.305 Script: batch           on        
< 2024-07-21 19:30:01.305 Script: reconnecttime   120       
> 2024-07-21 19:30:01.305 Script: option confirm off
< 2024-07-21 19:30:01.305 Script: confirm         off       
> 2024-07-21 19:30:01.305 Script: option reconnecttime 120
< 2024-07-21 19:30:01.305 Script: reconnecttime   120       
> 2024-07-21 19:30:01.305 Script: open sftp://someusername:***@11.222.333.44:5567 -hostkey="ssh-ed25519 255 DHhI/5fErnTc1txlbYDeBkRuhWkIMJl6axQRj4t/Xjs" -timeout=15 -rawsettings ProxyMethod="3" ProxyHost="10.26.46.92" ProxyPort="8080" Authorization="Basic R0VQT1dBVVRPVUFUOklwcnVhbWNAMTIzNDU2"
. 2024-07-21 19:30:01.305 --------------------------------------------------------------------------
. 2024-07-21 19:30:01.305 Session name: someusername@11.222.333.44 (Ad-Hoc site)
. 2024-07-21 19:30:01.305 Host name: 11.222.333.44 (Port: 5567)
. 2024-07-21 19:30:01.305 User name: someusername (Password: Yes, Key file: No, Passphrase: No)
. 2024-07-21 19:30:01.305 Tunnel: No
. 2024-07-21 19:30:01.305 Transfer Protocol: SFTP
. 2024-07-21 19:30:01.305 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2024-07-21 19:30:01.305 Disable Nagle: No
. 2024-07-21 19:30:01.305 Proxy: HTTP
. 2024-07-21 19:30:01.305 HostName: 10.26.46.92 (Port: 8080); Username: ; Passwd: No
. 2024-07-21 19:30:01.305 Send buffer: 262144
. 2024-07-21 19:30:01.305 Compression: No
. 2024-07-21 19:30:01.305 Bypass authentication: No
. 2024-07-21 19:30:01.305 Try agent: Yes; Agent forwarding: No; KI: Yes; GSSAPI: Yes
. 2024-07-21 19:30:01.305 GSSAPI: KEX: No; Forwarding: No; Libs: gssapi32,sspi,custom; Custom: 
. 2024-07-21 19:30:01.305 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2024-07-21 19:30:01.305 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2024-07-21 19:30:01.305 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2024-07-21 19:30:01.305 Simple channel: Yes
. 2024-07-21 19:30:01.305 Return code variable: Autodetect; Lookup user groups: Auto
. 2024-07-21 19:30:01.305 Shell: default
. 2024-07-21 19:30:01.305 EOL: LF, UTF: Auto
. 2024-07-21 19:30:01.305 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2024-07-21 19:30:01.305 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2024-07-21 19:30:01.305 SFTP Bugs: Auto,Auto
. 2024-07-21 19:30:01.305 SFTP Server: default
. 2024-07-21 19:30:01.305 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2024-07-21 19:30:01.305 Cache directory changes: Yes, Permanent: Yes
. 2024-07-21 19:30:01.305 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2024-07-21 19:30:01.305 DST mode: Unix
. 2024-07-21 19:30:01.305 --------------------------------------------------------------------------
< 2024-07-21 19:30:01.305 Script: Searching for host...
. 2024-07-21 19:30:01.305 Leaving host lookup to proxy of "11.222.333.44" (for SSH connection)
. 2024-07-21 19:30:01.305 Will use HTTP proxy at 10.26.46.92:8080 to connect to 11.222.333.44:5567
. 2024-07-21 19:30:01.305 Looking up host "10.26.46.92" for proxy
. 2024-07-21 19:30:01.305 Connecting to HTTP proxy at 10.26.46.92 port 8080
. 2024-07-21 19:30:01.305 Connecting to 10.26.46.92 port 8080
. 2024-07-21 19:30:01.305 Connected to 10.26.46.92
< 2024-07-21 19:30:01.305 Script: Connecting to host...
. 2024-07-21 19:30:01.305 We claim version: SSH-2.0-WinSCP_release_5.21.1
. 2024-07-21 19:30:01.305 Connected to 10.26.46.92
. 2024-07-21 19:30:01.305 Proxy error: Unable to parse auth header from HTTP proxy: authentication type 'NTLM' not supported
< 2024-07-21 19:30:01.321 Script: Proxy error: Unable to parse auth header from HTTP proxy: authentication type 'NTLM' not supported

Update 4: Here is the WinSCP log that is generated from Preference -> Logging:

. 2024-07-26 00:36:16.367 --------------------------------------------------------------------------
. 2024-07-26 00:36:16.367 WinSCP Version 5.21.1 (Build 12643 2022-06-24) (OS 10.0.17763 - Windows Server 2019 Standard)
. 2024-07-26 00:36:16.367 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2024-07-26 00:36:16.367 Log level: Normal
. 2024-07-26 00:36:16.367 Local account: somedomain\someuser
. 2024-07-26 00:36:16.367 Working directory: C:\Program Files (x86)\WinSCP
. 2024-07-26 00:36:16.367 Process ID: 10388
. 2024-07-26 00:36:16.383 Ancestor processes: explorer, ...
. 2024-07-26 00:36:16.383 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" 
. 2024-07-26 00:36:16.383 Time zone: Current: GMT+5:30 (India Standard Time), No DST
. 2024-07-26 00:36:16.383 Login time: 26 July 2024 00:36:16
. 2024-07-26 00:36:16.383 --------------------------------------------------------------------------
. 2024-07-26 00:36:16.383 Session name: session (Site)
. 2024-07-26 00:36:16.383 Host name: 11.222.333.44 (Port: 5567)
. 2024-07-26 00:36:16.383 User name: sftpusername (Password: Yes, Key file: No, Passphrase: No)
. 2024-07-26 00:36:16.383 Tunnel: No
. 2024-07-26 00:36:16.383 Transfer Protocol: SFTP (SCP)
. 2024-07-26 00:36:16.383 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2024-07-26 00:36:16.383 Disable Nagle: No
. 2024-07-26 00:36:16.383 Proxy: HTTP
. 2024-07-26 00:36:16.383 HostName: 10.26.46.92 (Port: 8080); Username: someuser; Passwd: Yes
. 2024-07-26 00:36:16.383 Send buffer: 262144
. 2024-07-26 00:36:16.383 Compression: No
. 2024-07-26 00:36:16.383 Bypass authentication: No
. 2024-07-26 00:36:16.383 Try agent: Yes; Agent forwarding: No; KI: Yes; GSSAPI: Yes
. 2024-07-26 00:36:16.383 GSSAPI: KEX: No; Forwarding: No; Libs: gssapi32,sspi,custom; Custom: 
. 2024-07-26 00:36:16.383 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2024-07-26 00:36:16.383 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2024-07-26 00:36:16.383 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2024-07-26 00:36:16.383 Simple channel: Yes
. 2024-07-26 00:36:16.383 Return code variable: Autodetect; Lookup user groups: Auto
. 2024-07-26 00:36:16.383 Shell: default
. 2024-07-26 00:36:16.383 EOL: LF, UTF: Auto
. 2024-07-26 00:36:16.383 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2024-07-26 00:36:16.383 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2024-07-26 00:36:16.383 SFTP Bugs: Auto,Auto
. 2024-07-26 00:36:16.383 SFTP Server: default
. 2024-07-26 00:36:16.383 Local directory: E:\somefolder, Remote directory: /dirname, Update: Yes, Cache: Yes
. 2024-07-26 00:36:16.383 Cache directory changes: Yes, Permanent: Yes
. 2024-07-26 00:36:16.383 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2024-07-26 00:36:16.383 DST mode: Unix
. 2024-07-26 00:36:16.383 --------------------------------------------------------------------------
. 2024-07-26 00:36:16.430 Leaving host lookup to proxy of "11.222.333.44" (for SSH connection)
. 2024-07-26 00:36:16.430 Will use HTTP proxy at 10.26.46.92:8080 to connect to 11.222.333.44:5567
. 2024-07-26 00:36:16.430 Looking up host "10.26.46.92" for proxy
. 2024-07-26 00:36:16.430 Connecting to HTTP proxy at 10.26.46.92 port 8080
. 2024-07-26 00:36:16.430 Connecting to 10.26.46.92 port 8080
. 2024-07-26 00:36:16.430 Connected to 10.26.46.92
. 2024-07-26 00:36:16.445 We claim version: SSH-2.0-WinSCP_release_5.21.1
. 2024-07-26 00:36:16.445 Connected to 10.26.46.92
. 2024-07-26 00:36:16.461 Connected to remote host
. 2024-07-26 00:36:16.461 Remote version: SSH-2.0-OpenSSH_8.7
. 2024-07-26 00:36:16.461 Using SSH protocol version 2
. 2024-07-26 00:36:16.461 Have a known host key of type ssh-ed25519
. 2024-07-26 00:36:16.477 Doing ECDH key exchange with curve Curve25519 and hash SHA-256
. 2024-07-26 00:36:16.617 Server also has ecdsa-sha2-nistp256/rsa-sha2-512/rsa-sha2-256/ssh-rsa host keys, but we don't know any of them
. 2024-07-26 00:36:16.617 Host key fingerprint is:
. 2024-07-26 00:36:16.617 ssh-ed25519 255 SHA256:DHhI/5fErnTc1txlbYDeBkRuhWkIMJl6axQRj4t/Xjy
. 2024-07-26 00:36:16.633 Host key matches cached key
. 2024-07-26 00:36:16.633 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] outbound encryption
. 2024-07-26 00:36:16.633 Initialised HMAC-SHA-256 outbound MAC algorithm
. 2024-07-26 00:36:16.633 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] inbound encryption
. 2024-07-26 00:36:16.633 Initialised HMAC-SHA-256 inbound MAC algorithm
! 2024-07-26 00:36:16.649 Using username "sftpusername".
. 2024-07-26 00:36:18.258 Server offered these authentication methods: publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive
. 2024-07-26 00:36:18.258 Using SSPI from SECUR32.DLL
. 2024-07-26 00:36:18.258 Trying gssapi-with-mic...
. 2024-07-26 00:36:18.258 Attempting GSSAPI authentication
. 2024-07-26 00:36:18.352 GSSAPI authentication request refused
. 2024-07-26 00:36:18.352 Server offered these authentication methods: publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive
. 2024-07-26 00:36:18.352 Attempting keyboard-interactive authentication
. 2024-07-26 00:36:18.477 Prompt (keyboard interactive, "SSH server authentication", <no instructions>, "Password: ")
. 2024-07-26 00:36:18.477 Using stored password.
. 2024-07-26 00:36:18.617 Prompt (keyboard interactive, "SSH server authentication", <no instructions>, <no prompt>)
. 2024-07-26 00:36:18.617 Ignoring empty SSH server authentication request
. 2024-07-26 00:36:18.649 Access granted
. 2024-07-26 00:36:18.649 Opening main session channel
. 2024-07-26 00:36:19.055 Opened main channel
. 2024-07-26 00:36:19.180 Started a shell/command
. 2024-07-26 00:36:19.195 --------------------------------------------------------------------------
. 2024-07-26 00:36:19.195 Using SFTP protocol.
. 2024-07-26 00:36:19.195 Doing startup conversation with host.
> 2024-07-26 00:36:19.211 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2024-07-26 00:36:19.258 Type: SSH_FXP_VERSION, Size: 238, Number: -1
. 2024-07-26 00:36:19.258 SFTP version 3 negotiated.
. 2024-07-26 00:36:19.258 Unknown server extension posix-rename@openssh.com="1"
. 2024-07-26 00:36:19.258 Supports statvfs@openssh.com extension version 2
. 2024-07-26 00:36:19.258 Unknown server extension fstatvfs@openssh.com="2"
. 2024-07-26 00:36:19.258 Supports hardlink@openssh.com extension version 1
. 2024-07-26 00:36:19.258 Unknown server extension fsync@openssh.com="1"
. 2024-07-26 00:36:19.258 Unknown server extension lsetstat@openssh.com="1"
. 2024-07-26 00:36:19.258 Supports limits@openssh.com extension version 1
. 2024-07-26 00:36:19.258 Unknown server extension expand-path@openssh.com="1"
. 2024-07-26 00:36:19.258 We believe the server has signed timestamps bug
. 2024-07-26 00:36:19.258 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 strings are not mandatory
. 2024-07-26 00:36:19.258 Limiting packet size to OpenSSH sftp-server limit of 262148 bytes
. 2024-07-26 00:36:19.258 Changing directory to "/sftpusername".
. 2024-07-26 00:36:19.258 Getting real path for '/sftpusername'
> 2024-07-26 00:36:19.258 Type: SSH_FXP_REALPATH, Size: 18, Number: 16
< 2024-07-26 00:36:19.320 Type: SSH_FXP_NAME, Size: 39, Number: 16
. 2024-07-26 00:36:19.320 Real path is '/sftpusername'
. 2024-07-26 00:36:19.320 Trying to open directory "/sftpusername".
> 2024-07-26 00:36:19.320 Type: SSH_FXP_LSTAT, Size: 18, Number: 263
< 2024-07-26 00:36:19.352 Type: SSH_FXP_ATTRS, Size: 37, Number: 263
. 2024-07-26 00:36:19.352 Getting current directory name.
. 2024-07-26 00:36:19.430 Listing directory "/sftpusername".
> 2024-07-26 00:36:19.430 Type: SSH_FXP_OPENDIR, Size: 18, Number: 523
< 2024-07-26 00:36:19.477 Type: SSH_FXP_HANDLE, Size: 13, Number: 523
> 2024-07-26 00:36:19.477 Type: SSH_FXP_READDIR, Size: 13, Number: 780
< 2024-07-26 00:36:19.508 Type: SSH_FXP_NAME, Size: 1039, Number: 780
> 2024-07-26 00:36:19.508 Type: SSH_FXP_READDIR, Size: 13, Number: 1036
< 2024-07-26 00:36:19.555 Type: SSH_FXP_STATUS, Size: 28, Number: 1036
< 2024-07-26 00:36:19.555 Status code: 1
> 2024-07-26 00:36:19.555 Type: SSH_FXP_CLOSE, Size: 13, Number: 1284
. 2024-07-26 00:36:19.555 ..;d;0;2024-04-12T16:18:28.000Z;4;"root" [0];"root" [0];rwxr-xr-x;0
. 2024-07-26 00:36:19.555 16072024;d;0;2024-07-16T11:40:12.000Z;4;"344815" [344815];"sftpaimsmember" [958];rwxrws---;0
. 2024-07-26 00:36:19.555 18072024;d;0;2024-07-18T12:04:29.000Z;4;"344815" [344815];"sftpaimsmember" [958];rwxrws---;0
. 2024-07-26 00:36:19.555 19072024;d;0;2024-07-19T11:43:05.000Z;4;"344815" [344815];"sftpaimsmember" [958];rwxrws---;0
. 2024-07-26 00:36:19.555 22072024;d;0;2024-07-22T11:39:34.000Z;4;"344815" [344815];"sftpaimsmember" [958];rwxrws---;0
. 2024-07-26 00:36:19.555 23072024;d;0;2024-07-23T11:34:56.000Z;4;"344815" [344815];"sftpaimsmember" [958];rwxrws---;0
. 2024-07-26 00:36:19.555 24072024;d;0;2024-07-24T11:42:45.000Z;4;"344815" [344815];"sftpaimsmember" [958];rwxrws---;0
. 2024-07-26 00:36:19.555 25072024;d;0;2024-07-25T11:43:47.000Z;4;"344815" [344815];"sftpaimsmember" [958];rwxrws---;0
. 2024-07-26 00:36:19.633 Startup conversation with host finished.

& here is the log file generated by the script using Session.SessionLogPath when GUI is open side by side:

. 2024-07-26 00:49:53.793 --------------------------------------------------------------------------
. 2024-07-26 00:49:53.793 WinSCP Version 5.21.1 (Build 12643 2022-06-24) (OS 10.0.17763 - Windows Server 2019 Standard)
. 2024-07-26 00:49:53.793 Configuration: nul
. 2024-07-26 00:49:53.793 Log level: Normal
. 2024-07-26 00:49:53.793 Local account: somedomain\someuser
. 2024-07-26 00:49:53.793 Working directory: C:\Program Files (x86)\WinSCP
. 2024-07-26 00:49:53.793 Process ID: 2088
. 2024-07-26 00:49:53.824 Ancestor processes: powershell, explorer, ...
. 2024-07-26 00:49:53.824 Command-line: "C:\Program Files (x86)\WinSCP\winscp.exe" /xmllog="C:\Users\someuser\AppData\Local\Temp\38\wscp3228.03C909A3.tmp" /xmlgroups /xmllogrequired /nointeractiveinput /stdout /stdin /dotnet=5.21.1  /ini=nul /log="D:\Schedulers\Powershell\BSEScriptSession25072024.log"  /console /consoleinstance=_12840_39236044_354
. 2024-07-26 00:49:53.824 Time zone: Current: GMT+5:30 (India Standard Time), No DST
. 2024-07-26 00:49:53.824 Login time: 26 July 2024 00:49:53
. 2024-07-26 00:49:53.824 --------------------------------------------------------------------------
. 2024-07-26 00:49:53.824 Script: Retrospectively logging previous script records:
> 2024-07-26 00:49:53.824 Script: option batch on
< 2024-07-26 00:49:53.824 Script: batch           on        
< 2024-07-26 00:49:53.824 Script: reconnecttime   120       
> 2024-07-26 00:49:53.824 Script: option confirm off
< 2024-07-26 00:49:53.824 Script: confirm         off       
> 2024-07-26 00:49:53.824 Script: option reconnecttime 120
< 2024-07-26 00:49:53.824 Script: reconnecttime   120       
> 2024-07-26 00:49:53.824 Script: open sftp://sftpusername:***@11.222.333.44:5567 -hostkey="ssh-ed25519 255 DHhI/5fErnTc1txlbYDeBkRuhWkIMJl6axQRj4t/Xjy" -timeout=15 -rawsettings ProxyMethod="3" ProxyHost="10.26.46.92" ProxyPort="8080" ProxyUsername="someuser" ProxyPassword=***
. 2024-07-26 00:49:53.824 --------------------------------------------------------------------------
. 2024-07-26 00:49:53.824 Session name: sftpusername@11.222.333.44 (Ad-Hoc site)
. 2024-07-26 00:49:53.824 Host name: 11.222.333.44 (Port: 5567)
. 2024-07-26 00:49:53.824 User name: sftpusername (Password: Yes, Key file: No, Passphrase: No)
. 2024-07-26 00:49:53.824 Tunnel: No
. 2024-07-26 00:49:53.824 Transfer Protocol: SFTP
. 2024-07-26 00:49:53.824 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2024-07-26 00:49:53.824 Disable Nagle: No
. 2024-07-26 00:49:53.824 Proxy: HTTP
. 2024-07-26 00:49:53.824 HostName: 10.26.46.92 (Port: 8080); Username: someuser; Passwd: Yes
. 2024-07-26 00:49:53.824 Send buffer: 262144
. 2024-07-26 00:49:53.824 Compression: No
. 2024-07-26 00:49:53.824 Bypass authentication: No
. 2024-07-26 00:49:53.824 Try agent: Yes; Agent forwarding: No; KI: Yes; GSSAPI: Yes
. 2024-07-26 00:49:53.824 GSSAPI: KEX: No; Forwarding: No; Libs: gssapi32,sspi,custom; Custom: 
. 2024-07-26 00:49:53.824 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2024-07-26 00:49:53.824 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2024-07-26 00:49:53.824 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2024-07-26 00:49:53.824 Simple channel: Yes
. 2024-07-26 00:49:53.824 Return code variable: Autodetect; Lookup user groups: Auto
. 2024-07-26 00:49:53.824 Shell: default
. 2024-07-26 00:49:53.824 EOL: LF, UTF: Auto
. 2024-07-26 00:49:53.824 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2024-07-26 00:49:53.824 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2024-07-26 00:49:53.824 SFTP Bugs: Auto,Auto
. 2024-07-26 00:49:53.824 SFTP Server: default
. 2024-07-26 00:49:53.824 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2024-07-26 00:49:53.824 Cache directory changes: Yes, Permanent: Yes
. 2024-07-26 00:49:53.824 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2024-07-26 00:49:53.824 DST mode: Unix
. 2024-07-26 00:49:53.824 --------------------------------------------------------------------------
< 2024-07-26 00:49:53.824 Script: Searching for host...
. 2024-07-26 00:49:53.824 Leaving host lookup to proxy of "11.222.333.44" (for SSH connection)
. 2024-07-26 00:49:53.824 Will use HTTP proxy at 10.26.46.92:8080 to connect to 11.222.333.44:5567
. 2024-07-26 00:49:53.824 Looking up host "10.26.46.92" for proxy
. 2024-07-26 00:49:53.824 Connecting to HTTP proxy at 10.26.46.92 port 8080
. 2024-07-26 00:49:53.824 Connecting to 10.26.46.92 port 8080
. 2024-07-26 00:49:53.824 Connected to 10.26.46.92
< 2024-07-26 00:49:53.824 Script: Connecting to host...
. 2024-07-26 00:49:53.824 We claim version: SSH-2.0-WinSCP_release_5.21.1
. 2024-07-26 00:49:53.824 Connected to 10.26.46.92
. 2024-07-26 00:49:53.870 Connected to remote host
. 2024-07-26 00:49:53.870 Remote version: SSH-2.0-OpenSSH_8.7
. 2024-07-26 00:49:53.870 Using SSH protocol version 2
. 2024-07-26 00:49:53.870 Have a known host key of type ssh-ed25519
. 2024-07-26 00:49:53.902 Doing ECDH key exchange with curve Curve25519 and hash SHA-256
. 2024-07-26 00:49:54.027 Server also has ecdsa-sha2-nistp256/rsa-sha2-512/rsa-sha2-256/ssh-rsa host keys, but we don't know any of them
. 2024-07-26 00:49:54.027 Host key fingerprint is:
. 2024-07-26 00:49:54.027 ssh-ed25519 255 SHA256:DHhI/5fErnTc1txlbYDeBkRuhWkIMJl6axQRj4t/Xjs
< 2024-07-26 00:49:54.027 Script: Authenticating...
. 2024-07-26 00:49:54.027 Host key matches configured key fingerprint
. 2024-07-26 00:49:54.027 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] outbound encryption
. 2024-07-26 00:49:54.027 Initialised HMAC-SHA-256 outbound MAC algorithm
. 2024-07-26 00:49:54.027 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] inbound encryption
. 2024-07-26 00:49:54.027 Initialised HMAC-SHA-256 inbound MAC algorithm
! 2024-07-26 00:49:54.121 Using username "sftpusername".
< 2024-07-26 00:49:54.121 Script: Using username "sftpusername".
. 2024-07-26 00:49:54.183 Server offered these authentication methods: publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive
. 2024-07-26 00:49:54.183 Using SSPI from SECUR32.DLL
. 2024-07-26 00:49:54.183 Trying gssapi-with-mic...
. 2024-07-26 00:49:54.183 Attempting GSSAPI authentication
. 2024-07-26 00:49:54.261 GSSAPI authentication request refused
. 2024-07-26 00:49:54.261 Server offered these authentication methods: publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive
. 2024-07-26 00:49:54.261 Attempting keyboard-interactive authentication
. 2024-07-26 00:49:54.355 Prompt (keyboard interactive, "SSH server authentication", <no instructions>, "Password: ")
. 2024-07-26 00:49:54.355 Using stored password.
< 2024-07-26 00:49:54.355 Script: Authenticating with pre-entered password.
. 2024-07-26 00:49:54.480 Prompt (keyboard interactive, "SSH server authentication", <no instructions>, <no prompt>)
. 2024-07-26 00:49:54.480 Ignoring empty SSH server authentication request
. 2024-07-26 00:49:54.636 Access granted
. 2024-07-26 00:49:54.636 Opening main session channel
. 2024-07-26 00:49:55.011 Opened main channel
. 2024-07-26 00:49:55.136 Started a shell/command
< 2024-07-26 00:49:55.136 Script: Authenticated.
. 2024-07-26 00:49:55.136 --------------------------------------------------------------------------
. 2024-07-26 00:49:55.136 Using SFTP protocol.
. 2024-07-26 00:49:55.136 Doing startup conversation with host.
< 2024-07-26 00:49:55.136 Script: Starting the session...
> 2024-07-26 00:49:55.136 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2024-07-26 00:49:55.214 Type: SSH_FXP_VERSION, Size: 238, Number: -1
. 2024-07-26 00:49:55.214 SFTP version 3 negotiated.
. 2024-07-26 00:49:55.214 Unknown server extension posix-rename@openssh.com="1"
. 2024-07-26 00:49:55.214 Supports statvfs@openssh.com extension version 2
. 2024-07-26 00:49:55.214 Unknown server extension fstatvfs@openssh.com="2"
. 2024-07-26 00:49:55.214 Supports hardlink@openssh.com extension version 1
. 2024-07-26 00:49:55.214 Unknown server extension fsync@openssh.com="1"
. 2024-07-26 00:49:55.214 Unknown server extension lsetstat@openssh.com="1"
. 2024-07-26 00:49:55.214 Supports limits@openssh.com extension version 1
. 2024-07-26 00:49:55.214 Unknown server extension expand-path@openssh.com="1"
. 2024-07-26 00:49:55.214 We believe the server has signed timestamps bug
. 2024-07-26 00:49:55.214 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 strings are not mandatory
. 2024-07-26 00:49:55.214 Limiting packet size to OpenSSH sftp-server limit of 262148 bytes
. 2024-07-26 00:49:55.214 Getting current directory name.
. 2024-07-26 00:49:55.214 Getting real path for '.'
> 2024-07-26 00:49:55.214 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2024-07-26 00:49:55.292 Type: SSH_FXP_NAME, Size: 39, Number: 16
. 2024-07-26 00:49:55.292 Real path is '/sftpusername'
. 2024-07-26 00:49:55.292 Startup conversation with host finished.
< 2024-07-26 00:49:55.292 Script: Session started.
< 2024-07-26 00:49:55.292 Script: Active session: [1] sftpusername@11.222.333.44
> 2024-07-26 00:49:55.449 Script: pwd
< 2024-07-26 00:49:55.449 Script: /sftpusername

Solution

  • @Martin

    I was able to solve this problem by adding:

    $sessionOptions.AddRawSettings("Proxy-Authorization", "Basic")
    

    Thanks!