13

I was redirected to this StackExchange, it is my first time here. The extent of experience I have with SSH keys begins and ends with the one time I setup the ability to push code to GitHub.

I need to access a FTP server via Cyberduck. I am in SFTP and need to "Choose..." a SSH Private Key. I have the TEXT for the private key that was messaged to me. So I can copy and paste it into a file? I'm not sure how to proceed and every resource I find is to generate a key rather than save a file to upload.

Guidance and resources are appreciated.

user5854648
  • 233
  • 1
  • 2
  • 5
  • 6
    The private key was sent to you? That's not a great start... (ideally you'd generate the keypair on your computer, and share the public key only) – Attie Jul 07 '20 at 20:33
  • 1
    You should be able to paste the text into a file, and select that file. It should begin with something like `-----BEGIN xx PRIVATE KEY-----` on a line, and end with a similar marker. The text between should be [base64](https://en.wikipedia.org/wiki/Base64#Base64_table) – Attie Jul 07 '20 at 20:34
  • Yes, the key was sent to me. Do I save this text in a file with a specific file . extension? Like .txt or something along those lines? – user5854648 Jul 07 '20 at 21:48
  • The extension shouldn't matter, `*.txt` is fine. – Attie Jul 07 '20 at 22:28
  • For Filezilla users: Choose "SFTP", enter the IP at "Host:", choose "Logon Type: Key file", insert correct username at "User:", choose private key file (note: rename it to yourfile`.ppk`). Then Filezilla can connect to the server. – Avatar Apr 05 '22 at 04:21

3 Answers3

14

if you use an sftp to connect to an sftp server, you should generate an ssh keypair (ie on unix: ssh-keygen) and provide your the public key (ie .ssh/id_rsa.pub or .ssh/id_ed25519.pub) to the sftp-server-admin.

if your ssh private key is in the default directory, the software may find it automatically.

if you use openssh (sftp is a part of it), you can use

sftp -i <privateKey> user@example.com

to connect to the sftp server, once the sftp-server-admin has put your ssh public key to the right location (depends on the setup and the ssh server used).

nikiwaibel
  • 141
  • 1
  • 5
4

You can save the text that was sent to you as a file and use the built in "Choose..." feature on Cyberduck. I am on a Windows machine so I used the Notepad app. I assume TextEdit on a Mac would have similar results. Here are the steps:

  1. Open Notepad
  2. Paste the text that was provided for your SSH key
  3. Save the file (I named mine key.txt)
  4. Open Cyberduck
  5. Select Open Connection
  6. Select SFTP (SSH File Transfer Protocol) for the connection type
  7. Enter server, port (22), username
  8. You can skip password - it will use the SSH key
  9. For SSH Private Key, select Choose... and find the save location of your file
  10. Click Connect
  11. The Unknown Fingerprint prompt will appear, click Allow (and you can select Always if this is a connection you trust and will often use)
  12. You should see your files and/or your assigned folder location!
Brad
  • 74
  • 5
2

Adding to the nikiwaibel's answer, some sftp versions won't accept the "-i" so you can use the alternative

sftp -oIdentityFile=<privateKey.file> user@example.com
Ion Harin
  • 21
  • 1