My script is asking for password

Advertisement

Toby
Joined:
Posts:
4

My script is asking for password

Hi guys
I am trying to automatically download files and delete them after the download
But when i run it keeps asking me for password
There is no password on the sftp server and it works with Winscp client

My script looks like this:

# Connect
open sftp://Username:@Servername/ -hostkey="ecdsa-sha2 key"
# Change remote directory
cd path-to-remote
# Force binary mode transfer
option transfer binary
# Download file to the local directory d:\
get -delete *.* path-to-local-machine

# Disconnect
close
# Exit WinSCP
exit

winscp.JPG

Reply with quote

Advertisement

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

Re: My script is asking for password

Please attach a complete session log file both from the script and GUI.

Reply with quote

Toby
Joined:
Posts:
4

Re: My script is asking for password

Toby wrote:

Hi guys
I am trying to automatically download files and delete them after the download
But when i run it keeps asking me for password
There is no password on the sftp server and it works with Winscp client

My script looks like this:

# Connect
open sftp://Username:@Servername/ -hostkey="ecdsa-sha2 key"
# Change remote directory
cd path-to-remote
# Force binary mode transfer
option transfer binary
# Download file to the local directory d:\
get -delete *.* path-to-local-machine

# Disconnect
close
# Exit WinSCP
exit


Last edited by Toby on 2018-02-23 09:42; edited 1 time in total

Reply with quote

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

Re: My script is asking for password

In GUI you are authenticating with private key:
. 2018-02-22 15:14:15.141 User name: ei000740 (Password: No, Key file: Yes, Passphrase: No)
...
. 2018-02-22 15:14:15.441 Reading key file "C:\Users\nemits\Desktop\Cert\IU_Private.ppk"
...
. 2018-02-22 15:14:15.512 Offered public key
. 2018-02-22 15:14:15.521 Offer of public key accepted
! 2018-02-22 15:14:15.521 Authenticating with public key "rsa-key-20180209"
. 2018-02-22 15:14:15.673 Sent public key signature
. 2018-02-22 15:14:15.677 Access granted
You have specified no private key in the script.

You can have the GUI generate a script template for you:
https://winscp.net/eng/docs/ui_generateurl#script

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum