Problem with Authentication

Advertisement

Gerhard_S
Joined:
Posts:
7
Location:
Berlin, Germany

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?

Reply with quote

Advertisement

Gerhard_S
Joined:
Posts:
7
Location:
Berlin, Germany

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

Reply with quote

Advertisement

You can post new topics in this forum