1

someone sent me the rsa keys in a zip, with theses ssh key then I should be able to clone a bitbucket repo. Exactly, he sent me a zip with 2 files:

  • key
  • key.rsa

Then, what should I do with that files? I am in ubuntu and I don't know how to proceed with that files in order to be allowed to download the repo

Sredny M Casanova
  • 4,735
  • 21
  • 70
  • 115
  • 1
    copy them into the hidden .ssh folder in your home directory. Then log into bitbucket via the website and paste your key under Setting -> Security -> SSH Keys – Dave Carruthers Oct 18 '17 at 15:38
  • To the close-voters: I disagree that this this is general computing (how do I open a Word document) or that this is professional server administration: this is a single machine and directly involves tools of programming. It does, however, lack basic research effort: https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html – msanford Oct 19 '17 at 13:09

1 Answers1

2

Not only you must copy them in your ~/.ssh folder, but you need to make sure:

  • they are named correctly:

    id_rsa (for the bigger of the two files)
    id_rsa.pub (for the smaller)
    
  • they are protected correctly

    chmod 600 id_rsa*
    

Then you can copy id_rsa.pub (make sure it is in one line) in your BitBucket account, ssh keys section.

Finally you can test if that is working with

ssh -Tv git@bitbucket.org

At the end, you should see:

logged in as <yourBitBucketAccount>.
You can use git or hg to connect to Bitbucket. Shell access is disabled.

That means you are properly authenticated, and will be able to push back to Bitbucket as yourself.
If you don't see that, the previous lines allows you to double-check what files are taken into account by ssh.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • IMHO, OP is definitely going to need guidance on what `ssh -Tv` will look like if it works. – msanford Oct 19 '17 at 05:07
  • 1
    @msanford Yes, I have edited the answer accordingly. – VonC Oct 19 '17 at 06:29
  • I'd add that it's not required to name the SSH keys (SSH itself calls them "identities") like that: the smaller (public) part's file is not needed to access the SSH server at all, and the private key can have arbitrary name, and then it can be configured in the `~/.ssh/config` file to be used when accessing the particular host (say, bitbucket). I understand that @VonC strived to put forward the simplest solution, so just summing a possible way for its refinement for the OP. – kostix Oct 19 '17 at 09:02
  • 1
    @kostix I confirm I was after the simplest setup. Example of config file: https://stackoverflow.com/a/45228981/6309 – VonC Oct 19 '17 at 09:29