Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

steve_wang

Fixed

Just upgraded the version from V5.13 to V5.17, it works well. Thanks. (Sorry I don't have the admin role on the dev environment to upgrade version)
steve_wang

Re: TunnelPasswordPlain not working in PowerShell script

I'm pretty sure the version WinSCP v5.13 has the problem of TunnelPasswordPlain in all kinds of scripts.
martin

Re: TunnelPasswordPlain not working in PowerShell script

It seems that you are running WinSCP from command-line. Why don't you use WinSCP .NET assembly? It would take care of correct encoding for you.

Anyway, you can try to enable password logging using /loglevel=*. That might help you with debugging the problem.
https://winscp.net/eng/docs/commandline#logging
steve_wang

Re: TunnelPasswordPlain not working in PowerShell script

I already converted the special character of my password into ASC code such as %21, etc. Both 2 passwords have the special character, the other password works well, only TunnelPasswordPlain has problem.
martin

Re: TunnelPasswordPlain not working in PowerShell script

Doesn't your password contain some special characters than may need escaping in PowerShell or in WinSCP?
steve_wang

The pre-entered password in URL works, but Tunnel Password not working

The Windows PowerShell console always ask me to manually enter password, then the following steps work well including the authentication of username/password in the URL.

See the console recording:
PS C:\temp\script> .\Transfer_Files.ps1

Opening tunnel...
Searching for host...
Connecting to host...
Authenticating...
Using username "username123".
Authenticating tunnel through 142.245.207.12
Password:
Authenticated.
Connecting through tunnel...
Searching for host...
Connecting to host...
Authenticating...
Using username "123_scp".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [1] 123_scp@142.245.206.141
C:\Steven\Projects\SCPC_Output
/home/123_scp/10_Seedfile_Oct_2021
CSPC_Adding_List.csv      |           5 KB |    0.0 KB/s | binary | 100%
Success
PS C:\temp\script>
steve_wang

TunnelPasswordPlain not working in PowerShell script

My WinSCP GUI works well for manfully inputting both Tunnel Username/password and access username/password. But the generated PowerShell script doesn't work. I added password into the script file. But it seems the program doesn't get Tunnel password, it's still say (Password: No).

See below log:

. 2021-10-21 09:22:24.189 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=5.19.2 /consoleinstance=_21264_257 "/log=C:\temp\log\WinSCP.log" "/ini=nul" "/command" "open scp://123_scp:***@142.123.001.123/ -hostkey=""ssh-rsa 2048 Y3P6mwpIMDu64ngZsiqOe9VVVK4vmnCubTg/T3YZIXE="" -rawsettings Tunnel=1 TunnelHostName=""142.001.001.12"" TunnelHostKey=""ssh-ed25519 255 +8C0z8OHdWLr0CM/o7VwV5jQ64Hzdck+rhTyPTy9bd0="" TunnelUserName=""q4mh8k9"" TunnelPasswordPlain=***" "lcd C:\Steven\Projects\SCPC_Output" "cd /home/123_scp/10_Seedfile_Oct_2021" "put CSPC_Adding_List.csv" "exit"

I did use TunnelPasswordPlain, but the log says the password is No:
. 2021-10-21 09:22:24.189 Tunnel: User name: username123(Password: No, Key file: No) 


. 2021-10-21 09:22:24.352 [Tunnel] Host key matches configured key fingerprint
. 2021-10-21 09:22:24.352 [Tunnel] Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] outbound encryption
. 2021-10-21 09:22:24.352 [Tunnel] Initialised HMAC-SHA-256 outbound MAC algorithm
. 2021-10-21 09:22:24.352 [Tunnel] Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] inbound encryption
. 2021-10-21 09:22:24.352 [Tunnel] Initialised HMAC-SHA-256 inbound MAC algorithm
! 2021-10-21 09:22:24.370 [Tunnel] Using username "username123".
< 2021-10-21 09:22:24.370 Script: Using username "username123".
! 2021-10-21 09:22:24.393 [Tunnel] SECURITY NOTICE:
! 2021-10-21 09:22:24.393 [Tunnel] Unauthorized use is prohibited. Use of this private computer system is your consent to being recorded and monitored. We reserve the right to seek all remedies for unauthorized use. Evidence of suspected illegal use may be given to law enforcement.
. 2021-10-21 09:22:24.393 [Tunnel] Server offered these authentication methods: publickey,gssapi-keyex,gssapi-with-mic,password
. 2021-10-21 09:22:24.393 [Tunnel] Using SSPI from SECUR32.DLL
. 2021-10-21 09:22:24.393 [Tunnel] Trying gssapi-with-mic...
. 2021-10-21 09:22:24.393 [Tunnel] Attempting GSSAPI authentication
. 2021-10-21 09:22:24.411 [Tunnel] GSSAPI authentication request refused
. 2021-10-21 09:22:24.411 [Tunnel] Server offered these authentication methods: publickey,gssapi-keyex,gssapi-with-mic,password
. 2021-10-21 09:22:24.411 [Tunnel] Prompt (password, "SSH password", <no instructions>, "&Password: ")

Any advise is helpful and appreciate.