Special characters in SFTP password (PowerShell)

Advertisement

Jimiboboyo
Guest

Special characters in SFTP password (PowerShell)

Hi
Have used the GUI to generate session code for PowerShell connection. The connection works in the GUI.
The password contains special characters.
I have enabled logging and the password being used is omitting the ' (apostrophe)
I have the password wrapped in double quotes
This doesn't seem like a normal apostrophe though it is slanted like maybe a grave accent or other.
How can I find out which character this is and force it to be included?
I tried using the URL tool to generate UTF-8 and this did the same thing
Regards

Jim

Reply with quote

Advertisement

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

Re: Special characters in sftp password (powershell)

So what exact character is that? Can you paste it here? (or its Unicode code)
For what language did you generate the code?

Reply with quote

jimiboboyo
Guest

Hi Martin

It is the following character I have pasted this in
`
I think it is identified as a grave accent from a UTF-8 website I established this
`   GRAVE ACCENT (U+0060)   60
I have tried to generate URL for password to then use the UTF-8 code in my PowerShell script and this character generates as %60 but I am unsure of the correct syntax.

Should the following syntax work?
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
    Protocol = [WinSCP.Protocol]::Sftp
    HostName = ""
    UserName = ""
    Password = "%60%50%30%20"   ##random utf-8 codes as example
    SshHostKeyFingerprint = ""
}

Reply with quote

Jimiboboyo
Guest

I have resolved this it is a PowerShell issue not a WinSCP issue.
Just needed to wrap the password in single quotes for it to parse the backtick.
If using double quotes the backtick is omitted.

Reply with quote

Advertisement

da_chicken
Joined:
Posts:
4
Location:
US

I ran into this issue today. The code generator in WinSCP 6.1.1 generates PowerShell code with double quotes. I happen to have a password with both a grave and a dollar sign in the password, and both of those are special characters with double-quoted string literals.

Reply with quote

Advertisement

You can post new topics in this forum