Topic "Password with special characters invalid in batch program"

Author Message
jtmorley
[View user's profile]

Joined: 2012-10-03
Posts: 5
I am running version 4.3.2 (Build 1201). I have other scripts running for a different site with a more normalized password. I'm wondering if a password in this format (not the actual password I'm using, but similar) with all the special characters is causing the problem. I tried a couple variations of putting quotes around it, but it failed also. I can get in thru the gui tool, and from command line. I just can't get it to work from a batch program.

Thanks


C:\cmd>winscp myUserName:t,!wx1`]+J1H@companyInfo.com:2 /script=getStuff.bat
Searching for host...
Connecting to host...
Authenticating...
Using username "myUserName".
Authenticating with pre-entered password.
Access denied.
Connection has been unexpectedly closed. Server sent command exit status 0.
Authentication log (see session log for details):
Using username "myUserName".
Access denied.

Authentication failed.
transfer ascii
No session.
C:\cmd>
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24554
Location: Prague, Czechia
Please read documentation:
http://winscp.net/eng/docs/session_url

If that does not help, come back.
_________________
Martin Prikryl
jtmorley
[View user's profile]

Joined: 2012-10-03
Posts: 5
prikryl wrote:
Please read documentation:
http://winscp.net/eng/docs/session_url

If that does not help, come back.



I did see a post about encoding, and had already tried it. I did notice I missed one, and tried it again, but I'm still not able to get in. What else should I try?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24554
Location: Prague, Czechia
Turn on loggign both in scripting and GUI and compare the logs to see if you are missing something.
_________________
Martin Prikryl
jtmorley
[View user's profile]

Joined: 2012-10-03
Posts: 5
prikryl wrote:
Turn on loggign both in scripting and GUI and compare the logs to see if you are missing something.


I added the logging, but nothing else really popped up. I started looking into just using Putty's psftp option. I got closer with it, but still had trouble with the password. I then tried a suggestion from Putty. Long story short, by adding an extra % in front of each encoded character fixes the password special character problem. Example %2B becomes %%2B.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24554
Location: Prague, Czechia
If you are running WinSCP from a batch file, then yes. You have not mentioned that.
_________________
Martin Prikryl
jtmorley
[View user's profile]

Joined: 2012-10-03
Posts: 5
prikryl wrote:
If you are running WinSCP from a batch file, then yes. You have not mentioned that.


Yes I did. Please refer to first posting.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24554
Location: Prague, Czechia
Ok, sorry. Anyway, did it help?
_________________
Martin Prikryl
jtmorley
[View user's profile]

Joined: 2012-10-03
Posts: 5
prikryl wrote:
Ok, sorry. Anyway, did it help?


Yes it did, thanks.
sam_boyz

Guest


prikryl wrote:
If you are running WinSCP from a batch file, then yes. You have not mentioned that.


Martin,

I have a password like <test12;:&>

I am using batch file.

I am enclosing the session url in double quotes as below:

open "sam:<test12;:&>@myserver" -hostkey=*

I am still getting auhthentication failed error?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24554
Location: Prague, Czechia
sam_boyz wrote:
I have a password like <test12;:&>

I am using batch file.

I am enclosing the session url in double quotes as below:

open "sam:<test12;:&>@myserver" -hostkey=*

You have to URL-encode the semicolon:
http://winscp.net/eng/docs/session_url
Guest




prikryl wrote:
sam_boyz wrote:
I have a password like <test12;:&>

I am using batch file.

I am enclosing the session url in double quotes as below:

open "sam:<test12;:&>@myserver" -hostkey=*

You have to URL-encode the semicolon:
http://winscp.net/eng/docs/session_url


Martin, I will not know the special characters in the password beforehand as the utility I am creating can be used by multiple users. I want a generic solution if there is?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24554
Location: Prague, Czechia
Anonymous wrote:
Martin, I will not know the special characters in the password beforehand as the utility I am creating can be used by multiple users. I want a generic solution if there is?

A generic solution is to URL-encode all non-alpha numeric characters in the password.
If your utility in .NET-based, you can use Uri.EscapeDataString method.
https://msdn.microsoft.com/en-us/library/system.uri.escapedatastring.aspx
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License