20

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.

5
  • 7
    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
    Commented Jul 7, 2020 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
    – Attie
    Commented Jul 7, 2020 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? Commented Jul 7, 2020 at 21:48
  • The extension shouldn't matter, *.txt is fine.
    – Attie
    Commented Jul 7, 2020 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
    Commented Apr 5, 2022 at 4:21

3 Answers 3

7

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!
20

if you use a sftp client to connect to a sftp server, you should generate a ssh keypair (ie on unix: ssh-keygen) and provide your 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> [email protected]

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).

2
  • Actually fails on RHEL6 Commented Mar 27 at 15:18
  • Also might need to chmod the key file to e.g. 0600 or something a bit restrictive otherwise it might be rejected as insecure. Commented Jun 15 at 10:37
8

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

sftp -oIdentityFile=<privateKey.file> [email protected]
2
  • This should be a comment.
    – Toto
    Commented May 30, 2023 at 9:55
  • This should be a comment upvote
    – lese
    Commented Oct 12, 2023 at 7:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .