how to get recovery code with only public keys and private keys

Abhishek.SinghSolanki December 23, 2019

Hi All,

i have lost my recovery code and 2FA is enabled in my account. Now I have also lost the APP from mobile I am not able to login to bitbucket. When I try to use ssh for recovering the recover codes it says "ssh is not found as internal or external command".

I have public key and private key in my system but not in .ssh folder which is generally place in ~/user/.ssh location. I have saved them in another folder. 

providing the only option of these 2 keys how can i recover my recovery codes to get access to my account? Please if someone can guide me step by step for doing all of the stuff.

1) How to run ssh command and where to run it? through command prompt or in git bash?

2) As my public key is already added while setting up the bit bucket account how can i use public key and private key to get the recovery codes?

 

TIA

Abhishek

1 answer

0 votes
Ganesh Babu
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 23, 2019

Hello,

Thats good that you have the ssh key with you. Try typing this command in the terminal you usually work with bitbucket.

ssh git@bitbucket.org recovery_codes

Then 6 recovery codes will be provided

Abhishek.SinghSolanki December 23, 2019

Where to fire this command? When I do this on CMD prompt then it gives error "command not found"

Andrew Morin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 23, 2019

If you are on a Windows computer either install Putty or follow the directions here to enable these commands.

https://www.howtogeek.com/336775/how-to-enable-and-use-windows-10s-built-in-ssh-commands/

Abhishek.SinghSolanki December 23, 2019

Thanks for this. But I am using Window server 2012. My machine is hosted on window server to connect to a remote machine.

Can you please for this setup?

Thanks

Abhishek

Andrew Morin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 23, 2019

Download and install it, will work fine on Windows. Once you open the promt and SSH to your server...wait a minute are you running BB on Windows? May still work..

 

https://www.putty.org/

Ganesh Babu
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 23, 2019

Is it showing "ssh is not found as internal or external command", if this is the case then ssh is not installed, you need to install ssh.

If ssh is already installed then set environment variable path.

How was the ssh key generated earlier? as you mention you have private and public keys with you.

And as you mention that you have stored your private key in another folder try to provide the path where your private key is stored.

Another thing is that you can try using putty.

Abhishek.SinghSolanki December 24, 2019

Hi @Ganesh Babu 

I have generate the keys using puttyGen and stored the public key into bitbucket setting.

When I am trying putty and hit the server it says Authentication failed (public key) error.

 

What should be the next step you suggest?

Andrew Morin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 24, 2019

We have a script for our Jira instance to change SSO to secondary. Here are the docs for doing this in Bitbucket but I am not sure it will help. I would reach out to Atlassian support.

https://confluence.atlassian.com/bitbucketserverkb/how-to-enable-auth_fallback-functionality-when-using-saml-in-bitbucket-data-center-975033030.html 

Ganesh Babu
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 24, 2019

Hi @Abhishek.SinghSolanki 

Better try with command prompt/git bash. 

Check whether the ssh installed. If not install the ssh. Please find the attached document that i followed. I have ssh installed and performed with git bash

And check whether do you have one or multiple private keys. If multiple provide the appropriate private key that is associated with the public key.

As you mentioned you generated it with putty , when trying with command prompt or git bash try to convert the ppk file to private key.

So these attached screenshot might help once all these are done jira5.png

I am not sure how to connect to bitbucket cloud with putty because the hostname or ip address should be defined inorder to connect to it. While if it server we can work around with it

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events