How to specify SSH key for sFTP

+1 vote
asked Jan 31, 2014 by lcryder (130 points)
edited Jan 31, 2014

Using the KeyGenerator app I've generated SSH private and public keys. How do I specify the key in .Net code for a sFTP session?

1 Answer

0 votes
answered Jan 31, 2014 by Jan Sotola (17,310 points)
edited Jan 31, 2014

I expect you are going to use the keys for authentication to an SFTP server. In that case, you have to:

  • Put the public key somewhere on your SFTP server and associate it with some user account.
    For instance in the OpenSSH server, you have to add the public key into file ~/.ssh/authorized_keys.
    (see here how to transform a public key to the OpenSSH format).
  • When connecting to that SFTP server with the Rebex SFTP component, load the private key and use it for authentication as described here.

If you are going to use your public/private key another way, please write us more detailed description of your intent.