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

martin

Re: Problem with Authentication

I do not see anythong wrong about your original open command.
But maybe you have some special charactrs in your password?
See here: https://winscp.net/eng/docs/session_url
Gerhard_S

I got it to run. The clue is in the content of the WinSCP.ini: this file contains the password (if this option was selected), the SSH key, and the last session (if selected). So, the script can look like:

# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect (pw is in winscp.ini)
open <username>@<host name>
# Change remote directory
cd /httpdocs
# Force binary mode transfer
option transfer binary
# Download file to the local directory d:\
get htaccess.txt d:\
# Disconnect
close
# Exit WinSCP
exit

The command line is:
winscp.exe /ini=WinSCP.ini /log=logfile.txt /console /script=login.txt
Gerhard_S

Problem with Authentication

Hi,
WinSCP works fine using the Windows GUI. Connection is done via SFTP, the host uses port 2222. When using a script, my password is rejected.
At the command prompt I enter:
winscp.exe /ini=WinSCP.ini /log=logfile.txt /console /script=login.txt

login.txt is:

option confirm off
open bewa43.berliner-wassertisch.net:<mypassword>@berliner-wassertisch.net -hostkey="ssh-rsa 2048 xx:xx:xx"
cd /httpdocs
option transfer binary
get htaccess.txt d:\
close
exit

The logfile says at the end:
Prompt (7, SSH password, , &Passwort:)
Using stored password.
Sent password
Access denied
Access denied
Prompt (7, SSH password, , &Passwort:)
Disconnected: Unable to authenticate

xx:xx:xx and <mypassword> are replaced by the appropriate values.
Is there any solution? Is the password stored in WSCP.ini only a dummy?