Where to get my SSH private key?

July 1, 2015 24.8k views

Hi, I have followed this tutorial to create a SSH key pair through my droplet's command line:

It seems everything went fine, but where is now my private key to use with FileZilla?

  • You'll need to copy the files in ~/.ssh/ with the name idrsa (one will be idrsa, and the other will be

    You'll also need to add that key to your authorized_keys file with this command:

    cat ~/.ssh/ >> ~/.ssh/authorized_keys
    chmod 600 ~/.ssh/authorized_keys

    The first line takes your key and allows it access to the system
    The second line makes sure authorized_keys has the proper permissions.

  • @JonsJava you shouldn't copy your private key to your server. The server only needs your public key - which should be stored in ~/.ssh/authorized_keys along with the other public keys that are allowed to connect - to authenticate you.

    @maelga open FileZilla, go to Preferences -> SFTP -> Add keys, and add your SSH private key (/home/yourusername/.ssh/id_rsa).

  • @kamaln7 I agree, but I was going with what he had already done -- created the key on the server.

    He needs the key in the authorized_keys list, so he can scp over the key pairs, add the public key into the authorized_keys list, and purge the keys from his server.

    So, how exactly is he supposed to add "/home/yourusername/.ssh/id_rsa if it is on his server he's SFTP'ing into?

    Sorry if I seem snippy. Just tired, I guess. My point remains, though.

  • @JonsJava If that is what happened, Step 1 was done in the wrong place and @maelga needs to re-do tutorial on their Linux/Mac machine to avoid needing to insecurely transfer private key. If it was a typo (the "create a SSH key pair through my droplet's command line" comment), then the steps @kamaln7 posted for Filezilla should solve this question.

Be the first one to answer this question.