Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

martin

Re: Batfile error in Authenticating with pre-entered password

@yimiez: So what kind of "further authentication" does your server require? Can you authenticate in WinSCP GUI? Or using any other client? Can you post session log file from WinSCP scripting and a successful authentication using WinSCP GUI (or the other client)?
yimiez

Batfile error in Authenticating with pre-entered password

I have a problem with file .bat
Can't Authentication with pre-enter password

Anyone can help ?
martin

Re: Script error in Authenticating with pre-entered password

@syed: I assume that in GUI you probably have SFTP configured (and consequently the generated code uses SFTP too). But your server seems to have SFTP broken. The GUI by default falls back to legacy SCP protocol in this situation. But the scripting does not.
syed

Script error in Authenticating with pre-entered password

I got the solution from anther thread on this platform to use SCP instead of SFTP.
"E:\BACKUP\WinSCP.com" ^
  /log="C:\writable\path\to\log\WinSCP.log" /ini=nul ^
  /command ^
    "open scp://cgpexpert:mt2013%%40HW@10.78.144.209/ -hostkey=""ssh-rsa 2048 g3UQWIbxa6xRT/ExIKbYGdoH5XVKkgGxte6tj7ApS2g=""" ^
    "dir" ^
    "cd /" ^
    "exit"
syed

Script error in Authenticating with pre-entered password

When I run below script, it's still giving error, while this script is generated from WinSCP GUI (Generate session URL/code). Now when I use command line then same user & password works normally but it does not work in script mode and give error. So, how do I fix this issue?

Batch file:
"E:\BACKUP\WinSCP.com" ^
  /log="C:\writable\path\to\log\WinSCP.log" /ini=nul ^
  /command ^
    "open sftp://cgpexpert:mt2013%%40HW@10.78.144.209/ -hostkey=""ssh-rsa 2048 g3UQWIbxa6xRT/ExIKbYGdoH5XVKkgGxte6tj7ApS2g=""" ^
    "dir" ^
    "cd /" ^
    "exit"

output:

Error occurred during logging. It's been turned off.
Can't open log file 'C:\writable\path\to\log\WinSCP.log'.
System Error. Code: 2.
The system cannot find the file specified
Searching for host...
Connecting to host...
Authenticating...
Using username "cgpexpert".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Connection has been unexpectedly closed. Server sent command exit status 127.
Cannot initialize SFTP protocol. Is the host running an SFTP server?
martin

Re: Connection has been unexpectedly closed. Server sent command exit status 0.

@Gilles.D: The credentials in the script are wrong. Are you able to connect in GUI? If you are, follow the advice in my previous post.
Gilles.D

Connection has been unexpectedly closed. Server sent command exit status 0.

Hello,

to connect to my server I use the following commands:
option batch on 
option confirm off
open sftp://otuser:OTMC4societe!@ptrimv03:22

But when connecting here is the error message that I have:
batch           on        

confirm         off       
Searching for host...
Connecting to host...
Authenticating...
Using username "user".
Authenticating with pre-entered password.
Connection has been unexpectedly closed. Server sent command exit status 0.
Authentication log (see session log for details):
Using username "user".
Authentication failed.

Obviously to connect to the server I must, after filling in the login and password, validate my connection, but I do not know how to fill that in the command line.

Could you help me?

Thank you in advance.

Gilles
Travis M

Re: "pre-entered password" fails, (FIX)

@alexandern: That was the fix for me. Thank you very much! You saved my day.
LUX

Re: "pre-entered password" fails, (FIX)

@alexandern: Great. Thank you! This was the clear answer for this question. The link to the encoding webpage was really helpful.
:D
Jens Frandsen

Re: "pre-entered password" fails, (FIX)

@alexandern - Thanks for so much for answering the question. I had a similar problem and had already read much of the documentation. The previous responses frustrated me as they clearly not helpful at all. Those types of responses could be generated by bot. Alas, here you not only posted the exact answer I needed, but you gave an example that helped me to instantly understand what you were saying. Now I'm thinking "got to write a script to encode my password, here I go" ... but you you really went the extra mile and provided the handy link to encode a password. Great answer, please keep up the good work.
alexandern

"pre-entered password" fails, (FIX)

I had a similar problem, everything would work in interactive mode but using the password in a script would fail.

Fix: Don't forget to encode your password!
E.g.
open sftp://some-user:my+1password@someserver.com

should be
open sftp://some-user:my%2B1password@someserver.com

Here use this to encode
https://winscp.net/eng/docs/session_url#special
neo4

i cant ssh

When I press login after I fill everything right, I get this message:
Authenticating with pre-entered password

plz help
martin

Re: Keep receving authenticating w/ pre-entered password..why!?!

Please read documentation. If that does not help, come back and post a log file.
LostAsCanBe

Keep receving authenticating w/ pre-entered password..why!?!

When I created a user name and password and hit login it worked, now when I hit login under the same user, this promt "authenticating with pre-entered password" comes up and when I enter in my password I get denied..WHY!?!=(