known_hosts messed up after ssh-host-key-changes instructions
Asked by josir:

I followed the instructions about the new host keys:

<https://bitbucket.org/blog/ssh-host-key-changes>

After that, when I tried to pull something from bitbucket, I got:

Warning: the ECDSA host key for 'bitbucket.org' differs from the key for the IP address '2406:da00:ff00::22e9:9f55'  
Offending key for IP in /home/josir/.ssh/known_hosts:32  
Matching host key in /home/josir/.ssh/known_hosts:166

I tried to remove all bitbucket keys:

ssh-keygen -R bitbucket.org

and replay the process. But the same problem occurs.

I also noticed that "curl <https://bitbucket.org/site/ssh>" is returning a different format that known_hosts stores.

I'm using Ubuntu 22.04

Could someone help me with that?


Answers:
author: josir
body: Hi folks, problem solved by support.

1) To remove duplicates entries:

ssh-keygen -R bitbucket.org \&\& sed -i.old -e '/AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/d' \~/.ssh/known_hosts \&\& curl <https://bitbucket.org/site/ssh> \>\> \~/.ssh/known_hosts

2) To add new entries:

curl <https://bitbucket.org/site/ssh> \>\> \~/.ssh/known_hosts

3) To test if works:

ssh git@bitbucket.org host_key_info

The answer could be 2 entries (blog just note one of them):

256 SHA256:FC73VB6C4OQLSCrjEayhMp9UMxS97caD/Yyi2bhW/J0 bitbucket.org (ECDSA)  
256 SHA256:ybgmFkzwOSotHTHLJgHO0QN8L0xErw6vd0VhFA9m3SM bitbucket.org (ED25519)

comments: author: dyey
body: Thanks [@josir](/t5/user/viewprofilepage/user-id/92127) this worked for me.


author: Jackson Douglas
body: Thanks, [@josir](/t5/user/viewprofilepage/user-id/92127) works!


author: Stanislav Filev
body: Thanks [@josir](https://community.atlassian.com/t5/user/viewprofilepage/user-id/92127) this saved me a lot of time


author: Vacit
body: thanks, saved a day of debugging :pray:


author: Dan Ade
body: ChatGPT was clueless. Award goes to human this time. Thanks mate.


author: Ricardo P?rez Lorenzo
body: Thanks [@josir](/t5/user/viewprofilepage/user-id/92127)


author: Surya Van Lierde
body: Thanks for taking the time to share the solution


author: hbozhao
body: I had the exact same issue. This worked like a charm!


author: Anil Agrawal
body: It worked.! Thanks.


author: kvaitulys
body: thanks


author: Jake Grabowski
body: thank you :)


author: Gennaro
body: after using this commands this is What I can see:  
**ssh-keygen -R bitbucket.org \&\& sed -i.old -e '/AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/d' \~/.ssh/known_hosts \&\& curl <https://bitbucket.org/site/ssh> \>\> \~/.ssh/known_hosts**   
# Host bitbucket.org found: line 5 type RSA  
# Host bitbucket.org found: line 6 type ECDSA  
/root/.ssh/known_hosts updated.  
Original contents retained as /root/.ssh/known_hosts.old  
% Total % Received % Xferd Average Speed Time Time Time Current  
Dload Upload Total Spent Left Speed  
100 836 100 836 0 0 2319 0 --:--:-- --:--:-- --:--:-- 2315  
root@-Frontend:\~#  
root@-Frontend:\~#  
root@-Frontend:\~#  
root@-Frontend:\~#  
root@-Frontend:\~#  
**root@-Frontend:\~# curl <https://bitbucket.org/site/ssh> \>\> \~/.ssh/known_hosts**   
% Total % Received % Xferd Average Speed Time Time Time Current  
Dload Upload Total Spent Left Speed  
100 836 100 836 0 0 2305 0 --:--:-- --:--:-- --:--:-- 2303  
root@-Frontend:\~#  
root@-Frontend:\~#  
root@-Frontend:\~#  
root@-Frontend:\~#  
**root@-Frontend:\~# ssh git@bitbucket.org host_key_info**   
key_read: uudecode AAAAC3NzaC1lZDI1NTE5AAAAIIazEu89wgQZ4bqs3d63QSMzYVa0MuJ2e2gKTKqu+UUObitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDQeJzhupRu0u0cdegZIa8e86EG2qOCsIsD1Xw0xSeiPDlCr7kq97NLmMbpKTX6Esc30NuoqEEHCuc7yWtwp8dI76EEEB1VqY9QJq6vk+aySyboD5QF61I/1WeTwu+deCbgKMGbUijeXhtfbxSxm6JwGrXrhBdofTsbKRUsrN1WoNgUa8uqN1Vx6WAJw1JHPhglEGGHea6QICwJOAr/6mrui/oB7pkaWKHj3z7d1IC4KWLtY47elvjbaTlkN04Kc/5LFEirorGYVbt15kAUlqGM65pk6ZBxtaO3+30LVlORZkxOh+LKL/BvbZ/iRNhItLqNyieoQj/uh/7Iv4uyH/cV/0b4WDSd3DptigWq84lJubb9t/DnZlrJazxyDCulTmKdOR7vs9gMTo+uoIrPSb8ScTtvw65+odKAlBj59dhnVp9zd7QUojOpXlL62Aw56U4oO+FALuevvMjiWeavKhJqlR7i5n9srYcrNV7ttmDw7kf/97P5zauIhxcjX+xHv4M=  
failed  
key_read: uudecode AAAAC3NzaC1lZDI1NTE5AAAAIIazEu89wgQZ4bqs3d63QSMzYVa0MuJ2e2gKTKqu+UUObitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDQeJzhupRu0u0cdegZIa8e86EG2qOCsIsD1Xw0xSeiPDlCr7kq97NLmMbpKTX6Esc30NuoqEEHCuc7yWtwp8dI76EEEB1VqY9QJq6vk+aySyboD5QF61I/1WeTwu+deCbgKMGbUijeXhtfbxSxm6JwGrXrhBdofTsbKRUsrN1WoNgUa8uqN1Vx6WAJw1JHPhglEGGHea6QICwJOAr/6mrui/oB7pkaWKHj3z7d1IC4KWLtY47elvjbaTlkN04Kc/5LFEirorGYVbt15kAUlqGM65pk6ZBxtaO3+30LVlORZkxOh+LKL/BvbZ/iRNhItLqNyieoQj/uh/7Iv4uyH/cV/0b4WDSd3DptigWq84lJubb9t/DnZlrJazxyDCulTmKdOR7vs9gMTo+uoIrPSb8ScTtvw65+odKAlBj59dhnVp9zd7QUojOpXlL62Aw56U4oO+FALuevvMjiWeavKhJqlR7i5n9srYcrNV7ttmDw7kf/97P5zauIhxcjX+xHv4M=  
failed  
Permission denied (publickey).

Can someone help me?


author: magic77
body: generate an ed25519 key if not done yet

ssh-keygen -t ed25519

At bitbucket add an new SSH Key visiting this Page

<https://bitbucket.org/account/settings/ssh-keys/>

Drop in the content from "id_ed25519.pub"

now it should work


author: Gennaro
body: I did what [@magic77](/t5/user/viewprofilepage/user-id/1269951) suggested:

now what we have:

**ssh git@bitbucket.org host_key_info**   
You are using host key with fingerprint:  
ecdsa-sha2-nistp256 SHA256:FC73VB6C4OQLSCrjEayhMp9UMxS97caD/Yyi2bhW/J0

See <https://bitbucket.org/blog/ssh-host-key-changes> for more detaills.

is it right?

**but my pipelines still fails with this error:**  
Host key verification failed.  
fatal: Could not read from remote repository.  
Please make sure you have the correct access rights  
and the repository exists.


author: magic77
body: [@Gennaro](/t5/user/viewprofilepage/user-id/5056842)key verification is correct now.

what helped for me was to edit known_hosts and removing all bitbucket entries

than run this command and try again

ssh-keygen -R bitbucket.org \&\& sed -i.old -e '/AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/d' \~/.ssh/known_hosts \&\& curl <https://bitbucket.org/site/ssh> \>\> \~/.ssh/known_hosts

if it fails again, than you should check if you setup ssh key for pipelines too for your repo


author: Gennaro
body: [@magic77](/t5/user/viewprofilepage/user-id/1269951) I have two known_hosts (I don't know why)  
in \~/.ssh/known_hosts

i can see:

\|1\|GXXkl0+3UrHVxtXgkGrho0a6CYo=\|9uUYtTnj/od4FEE9+wecfnZ824k= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAwbRs1nivqZp6LcqI3i0x4cch5SkfVbfZK/0xZAT/q8XtmKEkgdGQ70ktmy2A4G+WbVq7bLrR+blqMUAEHoIfg=  
\|1\|O4NNAVSC1tjy3zGxgKgdgIr6Uw4=\|TVqTeA4ggJDGwt3wAnqIWljylYs= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGtVO21yPG3iUWvUnZokkIZHZYUL8SRNCsULvg6ony4YoxzfeJA+4Rt04sibB6Z8QjuBo12WLZCl4U0jdxHrzUw=  
\|1\|bPzBAG1Yhbu03vsUTNjYEMGzrxc=\|jyD5X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iE= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw==  

what lines should I delete? In witch of two files?


author: magic77
body: [@Gennaro](/t5/user/viewprofilepage/user-id/5056842)normally ssh uses the default folder "\~/.ssh", but maybe you have an config file inside .ssh with additional ssh configuration setups

but try to run this command first

ssh-keygen -R bitbucket.org \&\& sed -i.old -e '/AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/d' \~/.ssh/known_hosts \&\& curl <https://bitbucket.org/site/ssh> \>\> \~/.ssh/known_hosts

and than check if you have access to repo, if not check ssh config for pipelines at bitbucket


author: Gennaro
body: [@magic77](/t5/user/viewprofilepage/user-id/1269951) I used the command   
ssh-keygen -R bitbucket.org \&\& sed -i.old -e '/AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/d' \~/.ssh/known_hosts \&\& curl <https://bitbucket.org/site/ssh> \>\> \~/.ssh/known_hosts

if I do the check

**ssh git@bitbucket.org host_key_info**   
You are using host key with fingerprint:  
ecdsa-sha2-nistp256 SHA256:FC73VB6C4OQLSCrjEayhMp9UMxS97caD/Yyi2bhW/J0

See <https://bitbucket.org/blog/ssh-host-key-changes> for more details.  
root@Stocksmetic-Frontend:\~/.ssh#

but the pipeline still fails:

![Schermata 2023-06-22 alle 09.07.01.png](https://community.atlassian.com/t5/image/serverpage/image-id/264425i72A38380D9365D4A/image-size/large?v=v2&px=999 "Schermata 2023-06-22 alle 09.07.01.png")


author: Aravinth Kandasamy
body: Thanks it worked.


author: Theodora Boudale
body: Hi,

[@Gennaro](/t5/user/viewprofilepage/user-id/5056842), I see that you created a ticket with the support team. Please provide in the support ticket the URL of the Pipelines build that fails and the engineer working on your ticket will look into this.

[@Aravinth Kandasamy](/t5/user/viewprofilepage/user-id/3923650), just a heads up, it is not necessary to generate new SSH keys to connect to Bitbucket Cloud, if you already had SSH keys set up. (It is not a problem that you did though)

The "Permission denied" error means that your private SSH key is not being offered when you ssh to bitbucket.org.

You can create a file named **config** in your **\~/.ssh** folder and add the following content in this file:

```
Host bitbucket.org
AddKeysToAgent yes
? ? IdentityFile ~/.ssh/id_ed25519
```

Then try executing the command git@bitbucket.org host_key_info again.

Kind regards,  
Theodora


author: HTT
body: Edit: Solved


author: Aravinth Kandasamy
body: @[Theodora Boudale](https://community.atlassian.com/t5/user/viewprofilepage/user-id/818086) Thanks for your suggestion. It worked for me.


author: Cristian Ram?rez
body: Thank you!


author: Hoang Nguyen
body: This works, thanks!


author: Vladim?r ?amaj
body: Thank you very much. You saved my day.


author: aussieinchile
body: Brilliant, thank you.


author: Mark Gil Gutierrez
body: Thanks brother!


author: Julian
body: I noticed the same: curl <https://bitbucket.org/site/ssh>" is returning a different format  
Go to the site using the browser and copy the content into \~./ssh/known_hosts

comments: author: MoG
body: Thanks Julian! This worked for me.


author: Erik Yamamoto
body: Same here, *curl* didn't work, but copy and paste directly from the link to the *known_hosts* file worked fine! Thanks!


author: Reginaldo Marques Ruiz
body: SUP Guys!!!

I Have the same problem, but, unfortable I use powershell, and in powershell this commands didn't work.

Could someone help me? Please

Warning: the ECDSA host key for 'bitbucket.org' differs from the key for the IP address '104.192.141.1'


author: Dramico Colebrooke
body: For us we had to add a newline to the end of the curl command that was provided in the guide.


author: Adam J. Mendoza
body: Excellent! Fixed the issue, thx


author: magic77
body: Had the same Problem and tried with

ssh-keygen -R bitbucket.org \&\& sed -i.old -e '/AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/d' \~/.ssh/known_hosts \&\& curl <https://bitbucket.org/site/ssh> \>\> \~/.ssh/known_hosts

Testing connection fails with:

Permission denied (publickey)

does somebody has an Idea?

EDIT: my fault, forgot to add the new SSH Key to bitbucket


author: Theodora Boudale
body: Hi [@josir](/t5/user/viewprofilepage/user-id/92127),

You can create a ticket with the support team and a support engineer will help you with these issues. You can create a ticket via <https://support.atlassian.com/contact/#/>

* In "What can we help you with?" select **Technical issues and bugs**
* In "Which product is this for?" select Bitbucket Cloud
* In the next field enter your workspace URL
* In "Are you having an issue with Bitbucket SSH Connections?" select **Yes**
* Then, scroll down and select **Need more help?** to fill in the ticket details

Kind regards,  
Theodora

comments: author: josir
body: Thanks Theodora. When support team respond, I will post the answer here. It can be helpfull to other users.


author: Jessica Hrudey
body: That would be great if you could share the answer when you get it, Josir. Thanks! I am having the same issue.


author: Mickael Merlet
body: Hello,  
I am having the same issue too :   

$ ssh git@bitbucket.org host_key_info  
Warning: the ECDSA host key for 'bitbucket.org' differs from the key for the IP address '\*\*\*.\*\*\*.\*\*\*.\*'  
Offending key for IP in /c/Users/mm/.ssh/known_hosts:9  
Matching host key in /c/Users/mm/.ssh/known_hosts:14  
Are you sure you want to continue connecting (yes/no)? yes  
You are using host key with fingerprint:  
ecdsa-sha2-nistp256 SHA256:\*\*\*\*  


author: artem.fedirchyk
body: Hi guys, I have the same issue too. Thank you in advance for the answer!


author: dyey
body: I'm having this issue too after following the steps from [https://bitbucket.org/blog/ssh-host-key-changes.](https://bitbucket.org/blog/ssh-host-key-changes)   

$ git pull  
Warning: the ECDSA host key for 'bitbucket.org' differs from the key for the IP address 'xxx.xxx.xxx.x'  
Offending key for IP in /home/dyeyuen/.ssh/known_hosts:6  
Matching host key in /home/dyeyuen/.ssh/known_hosts:30  
Are you sure you want to continue connecting (yes/no)? yes  
From bitbucket.org:my_org/my_repo  

...leaving this comment here to get notifications for updates. Thanks!


author: Jackson Douglas
body: Hi folks, I have the same issue too. Thank you in advance for the answer!


author: Julian
body: [@dyey](/t5/user/viewprofilepage/user-id/5014338) I think you have to remove the previous entries of bitbucket in known_hosts file  
Those are the old public keys


author: Julian
body: I repost my previous comment here:

I noticed the same: curl <https://bitbucket.org/site/ssh>" is returning a different format. Go to the site using the browser and copy the content into \~./ssh/known_hosts


author: Patrik S
body: Hello all,

The warning message you are receiving is likely related to old entries on your known_hosts file that are pointing to the bitbucket IP, instead of the domain name bitbucket.org.

To resolve this issue, you can remove the older entries and store the new ones using the following command :

```
ssh-keygen -R http://bitbucket.org/ && sed -i.old -e '/AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/d' ~/.ssh/known_hosts && curl https://bitbucket.org/site/ssh >> ~/.ssh/known_hosts
```

This is also covered in our [Bitbucket Cloud SSH rotation FAQ](https://confluence.atlassian.com/bbkb/bitbucket-cloud-ssh-host-key-rotation-faq-1235851234.html)

Thank you!

Patrik S


author: josir
body: Hi Patrick, I've done that already. But this command didn't add the new key:

josir@casa2:\~$ ssh git@bitbucket.org host_key_info  
You are using host key with fingerprint:  
ecdsa-sha2-nistp256 SHA256:FC73VB6C4OQLSCrjEayhMp9UMxS97caD/Yyi2bhW/J0

See <https://bitbucket.org/blog/ssh-host-key-changes> for more details.

It's better than the published on blog because it removes the duplicated lines but it didn't add the new host key.

I created a support ticket for that:

<https://support.atlassian.com/requests/BBS-202972>


author: hsandt
body: I cannot see the ticket. Is is private?

I also noticed that <https://bitbucket.org/site/ssh> doesn't show the same RSA key as <https://bitbucket.org/blog/ssh-host-key-changes>, probably because the former is the current one and the latter shows the new RSA key after the rotation in June 20 (this means if you added it before, it will cease to work after the rotation date; but you should switch to ECDSA/ED25519 anyway).

I'll probably just add those 2 keys manually, then see if I also get a warning.


author: josir
body: Hi [@hsandt](/t5/user/viewprofilepage/user-id/3267677) probably all support tickets are private.


author: Jan Szyma?ski
body: Thanks it works.


author: Zach Risher
body: [@josir](/t5/user/viewprofilepage/user-id/92127)'s original suggestion worked for me, thank you!


Tags: cloud

ssh