Password with special characters invalid in batch program

Advertisement

jtmorley
Joined:
Posts:
5

Password with special characters invalid in batch program

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>

Reply with quote

Advertisement

jtmorley
Joined:
Posts:
5

Re: Password with special characters invalid in batch program

martin wrote:

Please read documentation:
https://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?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,317
Location:
Prague, Czechia

Re: Password with special characters invalid in batch program

Turn on loggign both in scripting and GUI and compare the logs to see if you are missing something.
_________________
Martin Prikryl

Reply with quote

jtmorley
Joined:
Posts:
5

Re: Password with special characters invalid in batch program

martin 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.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,317
Location:
Prague, Czechia

Re: Password with special characters invalid in batch program

If you are running WinSCP from a batch file, then yes. You have not mentioned that.
_________________
Martin Prikryl

Reply with quote

jtmorley
Joined:
Posts:
5

Re: Password with special characters invalid in batch program

martin 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.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,317
Location:
Prague, Czechia

Re: Password with special characters invalid in batch program

Ok, sorry. Anyway, did it help?
_________________
Martin Prikryl

Reply with quote

jtmorley
Joined:
Posts:
5

Re: Password with special characters invalid in batch program

martin wrote:

Ok, sorry. Anyway, did it help?

Yes it did, thanks.

Reply with quote

Advertisement

sam_boyz
Guest

Re: Password with special characters invalid in batch program

martin 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?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,317
Location:
Prague, Czechia

Re: Password with special characters invalid in batch program

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:
https://winscp.net/eng/docs/session_url

Reply with quote

Guest

Re: Password with special characters invalid in batch program

martin 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:
https://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?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,317
Location:
Prague, Czechia

Re: Password with special characters invalid in batch program

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

Reply with quote

Advertisement

You can post new topics in this forum