Topic "Connecting with .ppk private key to a SFTP"

Author Message
AlLeX_
[View user's profile]

Joined: 2012-10-11
Posts: 13
Hi,

I need to connect to a SFTP server with a private .ppk key. I can connect with no problems with WinSCP GUI.
I am trying with CLI, but now luck. Could you, please, tell me the exact syntax of the command I must use.

Thanks
Advertisements
AlLeX_
[View user's profile]

Joined: 2012-10-11
Posts: 13
Here it is the picture, so the things are clearer Smile

How to specify the private key with CLI, this is not the Host key, right ?
Login.jpg (61.7 KB)

Description: WinSCP Login

Login.jpg

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
What do you mean by CLI? Scripting?
Use -privatekey= switch of open commmand:
https://winscp.net/eng/docs/scriptcommand_open

If you really mean command-line, there's equivalent /privatekey= command-line parameter:
https://winscp.net/eng/docs/commandline#session
_________________
Martin Prikryl
AlLeX_
[View user's profile]

Joined: 2012-10-11
Posts: 13
Thanks, I will try it.
Yes, cli is command line interface!
AlLeX_
[View user's profile]

Joined: 2012-10-11
Posts: 13
1. the simple commands winscp.com /command "open user@sftp_srv" /privatekey=c:\private.ppk or winscp.exe /console.... work perfectly.

2. But I want to use a script file

winscp.com /script=script_file.txt and in the script_file.txt I specify the private key

open user@sftp_srv /privatekey=..... This does not workand the error is "Too many parameters with open". Appearently the /privatekey switch here is the problem because without it, the script starts to open the session - of course it fails.
Is there a way to use /privatekey within a script file ?

Thanks
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
There should be a dash, not slash before privatekey, i.e. -privatekey=
See https://winscp.net/eng/docs/scriptcommand_open
_________________
Martin Prikryl
AlLeX_
[View user's profile]

Joined: 2012-10-11
Posts: 13
I have decided to usе a saved session.
Thank you!
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