Topic "WinSCP authentication with ssh"

Author Message
Hipponen

Guest


Hello,

I want to use a WinSCP script to get files from Linux server with Windows Command Prompt.

I use a script for that

# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect to SFTP server using a password
open sftp://user@ip:port/ -hostkey="ssh-rsa 2048 fingerprint"
# Upload file
get out/* C:\Users\Timo\Documents\Olerex\in\
# Disconnect
close
bye

When I run it in Command Prompt it tries to authenticate with password , that is not allowed.
Advertisements
Guest




This is what CMD looks like.
Capture.PNG (20.15 KB) [Download]

Description: (none)

Hipponen
[View user's profile]

Joined: 2015-11-19
Posts: 2
I know that connection is closed because password authentication is disabled, but why it's not using SSH.
Port is open and I can login wit WinSCP GUI using the private.ppk file.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
If you want to login with a private key, you have to specify it (as you do in the GUI). Use -privatekey switch:
http://winscp.net/eng/docs/scriptcommand_open
Hipponen
[View user's profile]

Joined: 2015-11-19
Posts: 2
prikryl wrote:
If you want to login with a private key, you have to specify it (as you do in the GUI). Use -privatekey switch:
http://winscp.net/eng/docs/scriptcommand_open


Thank you, your solution is correct, but I figured out the same thing couple of hours ago after wasting like 6h Very Happy
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License