Topic ".PPK file and upload automation in C#"

Author Message
brettrsmithjr
[View user's profile]

Joined: 2012-02-24
Posts: 4
I was able to run and activate the WinSCP.com file, but how do you script with C# how to include a username, a private PPK file to open the sftp gateway and then upload a file from a network directory? I would greatly appreciate your help. Thanks
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
For a general guide see
http://winscp.net/eng/docs/guide_automation

brettrsmithjr wrote:
how do you script with C# how to include a username, a private PPK file to open the sftp gateway

http://winscp.net/eng/docs/scriptcommand_open
http://winscp.net/eng/docs/session_url

Quote:
and then upload a file from a network directory?

http://winscp.net/eng/docs/scriptcommand_put
_________________
Martin Prikryl
brettrsmithjr
[View user's profile]

Joined: 2012-02-24
Posts: 4
OK, so how am I supposed to do it if I do not have a password, just a username and a ftp site with port information? I also want to know how can I write this in C#?
TimU
[View user's profile]

Joined: 2012-01-30
Posts: 25
Location: Sydney
brettrsmithjr wrote:
OK, so how am I supposed to do it if I do not have a password, just a username and a ftp site with port information?

1) Have you been given the private key by the S/FTP site administrator, or have you generated one yourself?
2) Were you given the key in PPK or OpenSSH format?

Assuming (please check & confirm) that you've been supplied with the Private Key, and that it's in PPK format, you can use this command to establish your connection with the S/FTP site:
open <protocol>://<username>@<hostname> -privatekey="<FullPathToKeyFile>.ppk" -hostkey="<your servers host key>"

example:
open sftp://SFTPUser@SFTPServer.domain.local -privatekey="D:\sftp\keys\SFTPUser.ppk" -hostkey="ssh-rsa 1024 e2:dd:11:2e:82:32:ab:62:59:1c:c8:62:1d:2b:28:99"


brettrsmithjr wrote:
I also want to know how can I write this in C#?

See here for C# programming help.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
TimU wrote:
brettrsmithjr wrote:
I also want to know how can I write this in C#?

See here for C# programming help.

Please check:
http://winscp.net/eng/docs/library
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