Re: Help With curl error 60 and the known _hosts file
Bastian Jesuiter via curl-users <[email protected]> Wed, 18 Mar 2026 22:46:33 +0100
| Newsgroups | gmane.comp.web.curl.general |
|---|---|
| Message-ID | <CAL07qPVKCevHv9OqwjqEJU=j7h-GfY3jswcM11E7AjCZWHu6hw@mail.gmail.com> |
--===============0108414024542860186== Content-Type: multipart/alternative; boundary="00000000000081f16c064d53631a" --00000000000081f16c064d53631a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, In general please be really careful with accepting new host keys. The host keys should not change in normal circumstances ever. Did you reinstall your raspi? Otherwise make sure to check if someone is man in the middle on your ssh connection, which may lead to your raspberry pi being compromised. Depending on which user the curl is called with, the "known hosts" file changes. If it's a cronjob, check which user is actually executing the script. If it's another user than the user you tried to ssh with, than that's the reason why curl still fails. Each user has its own known hosts file. Bastian On Wed, 18 Mar 2026, 22:24 Michael Newman via curl-users, < [email protected]> wrote: > Please understand that I am a naive user who understands very little of > how this all works. > > I have four Raspberry Pies in two different locations each of which uses > curl to upload a web cam image to a web host once every two minutes. This > has been working well for many years. > > Suddenly at about 3:08 PM today (Thailand time) all of the uploads began > failing as follows: > > Wed Mar 18 15:08:21 +07 2026 Upload Ended 7 - raspsky > curl: (7) Failed to connect to mydomain.com port 22: Connection refused > > At about 3:34 that changed to: > > Wed Mar 18 15:34:19 +07 2026 Upload Ended 60 - raspsky > curl: (60) SSL peer certificate or SSH remote key was not OK > > Assuming that it was the SSH remote key that was the problem I tried > logging in to the host via SSH. Sure enough, I was told that the host key > did not match the known_hosts file. So, I permitted the =E2=80=9Cnew=E2= =80=9D host key to > be added to the known_hosts file after which I was able to log in via SSH > which I can still do. > > Sadly, curl still fails even though the new and known-correct host key is > in the known_hosts file. > > So, what do I need to do to get curl to find the new host key in the > updated known_hosts file? > > Or, do I have this completely wrong and need to do something completely > different? > > Thanks in advance, > > Mike Newman > Korat, Thailand > > > -- > Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users > Etiquette: https://curl.se/mail/etiquette.html > --00000000000081f16c064d53631a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto">Hi,=C2=A0<div dir=3D"auto"><br></div><div dir=3D"auto">In= general please be really careful with accepting new host keys.=C2=A0</div>= <div dir=3D"auto"><br></div><div dir=3D"auto">The host keys should not chan= ge in normal circumstances ever.=C2=A0</div><div dir=3D"auto">Did you reins= tall your raspi?=C2=A0</div><div dir=3D"auto"><br></div><div dir=3D"auto">O= therwise make sure to check if someone is man in the middle on your ssh con= nection, which may lead to your raspberry pi being compromised.=C2=A0</div>= <div dir=3D"auto"><br></div><div dir=3D"auto">Depending on which user the c= url is called with, the "known hosts" file changes.=C2=A0</div><d= iv dir=3D"auto"><br></div><div dir=3D"auto">If it's a cronjob, check wh= ich user is actually executing the script. If it's another user than th= e user you tried to ssh with, than that's the reason why curl still fai= ls. Each user has its own known hosts file.=C2=A0</div><div dir=3D"auto"><b= r></div><div dir=3D"auto">Bastian</div></div><br><div class=3D"gmail_quote = gmail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, 18 Mar= 2026, 22:24 Michael Newman via curl-users, <<a href=3D"mailto:curl-user= [email protected]">[email protected]</a>> wrote:<br></div><blockquo= te class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc so= lid;padding-left:1ex">Please understand that I am a naive user who understa= nds very little of how this all works.<br> <br> I have four Raspberry Pies in two different locations each of which uses cu= rl to upload a web cam image to a web host once every two minutes. This has= been working well for many years.<br> <br> Suddenly at about 3:08 PM today (Thailand time) all of the uploads began fa= iling as follows:<br> <br> Wed Mar 18 15:08:21 +07 2026 Upload Ended 7 - raspsky<br> curl: (7) Failed to connect to <a href=3D"http://mydomain.com" rel=3D"noref= errer noreferrer" target=3D"_blank">mydomain.com</a> port 22: Connection re= fused<br> <br> At about 3:34 that changed to:<br> <br> Wed Mar 18 15:34:19 +07 2026 Upload Ended 60 - raspsky<br> curl: (60) SSL peer certificate or SSH remote key was not OK<br> <br> Assuming that it was the SSH remote key that was the problem I tried loggin= g in to the host via SSH. Sure enough, I was told that the host key did not= match the known_hosts file. So, I permitted the =E2=80=9Cnew=E2=80=9D host= key to be added to the known_hosts file after which I was able to log in v= ia SSH which I can still do.<br> <br> Sadly, curl still fails even though the new and known-correct host key is i= n the known_hosts file.<br> <br> So, what do I need to do to get curl to find the new host key in the update= d known_hosts file?<br> <br> Or, do I have this completely wrong and need to do something completely dif= ferent?<br> <br> Thanks in advance,<br> <br> Mike Newman<br> Korat, Thailand<br> <br> <br> -- <br> Unsubscribe: <a href=3D"https://lists.haxx.se/mailman/listinfo/curl-users" = rel=3D"noreferrer noreferrer" target=3D"_blank">https://lists.haxx.se/mailm= an/listinfo/curl-users</a><br> Etiquette:=C2=A0 =C2=A0<a href=3D"https://curl.se/mail/etiquette.html" rel= =3D"noreferrer noreferrer" target=3D"_blank">https://curl.se/mail/etiquette= .html</a><br> </blockquote></div> --00000000000081f16c064d53631a-- --===============0108414024542860186== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users Etiquette: https://curl.se/mail/etiquette.html --===============0108414024542860186==--