Re: Help With curl error 60 and the known _hosts file
Michael Newman via curl-users <[email protected]> Thu, 19 Mar 2026 06:01:46 +0700
| Newsgroups | gmane.comp.web.curl.general |
|---|---|
| Message-ID | <[email protected]> |
--===============2532857683047749099== Content-Type: multipart/signed; boundary="Apple-Mail=_9AFBA280-7877-4571-8DE9-1575C53AE733"; protocol="application/pkcs7-signature"; micalg=sha-256 --Apple-Mail=_9AFBA280-7877-4571-8DE9-1575C53AE733 Content-Type: multipart/alternative; boundary="Apple-Mail=_296BD8DB-1331-4788-B686-A1CBE0974474" --Apple-Mail=_296BD8DB-1331-4788-B686-A1CBE0974474 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Thank you for the advice. The scripts are all systemd jobs executed by = the user pi.=20 I wrote a test script using sftp instead of curl and it works fine. No = authentication problems. So, I guess I=E2=80=99ll rewrite all four scripts (one per machine) to = use sftp and give up on curl. I contacted the web host to ask why the host keys changed. They had no = clue and promised to get back to me but that was over 12 hours ago. > On Mar 19, 2026, at 04:46, Bastian Jesuiter via curl-users = <[email protected]> wrote: >=20 > Hi,=20 >=20 > In general please be really careful with accepting new host keys.=20 >=20 > The host keys should not change in normal circumstances ever.=20 > Did you reinstall your raspi?=20 >=20 > 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.=20= >=20 > Depending on which user the curl is called with, the "known hosts" = file changes.=20 >=20 > 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.=20= >=20 > Bastian >=20 > On Wed, 18 Mar 2026, 22:24 Michael Newman via curl-users, = <[email protected] <mailto:[email protected]>> wrote: >> Please understand that I am a naive user who understands very little = of how this all works. >>=20 >> 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. >>=20 >> Suddenly at about 3:08 PM today (Thailand time) all of the uploads = began failing as follows: >>=20 >> Wed Mar 18 15:08:21 +07 2026 Upload Ended 7 - raspsky >> curl: (7) Failed to connect to mydomain.com <http://mydomain.com/> = port 22: Connection refused >>=20 >> At about 3:34 that changed to: >>=20 >> Wed Mar 18 15:34:19 +07 2026 Upload Ended 60 - raspsky >> curl: (60) SSL peer certificate or SSH remote key was not OK >>=20 >> 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. >>=20 >> Sadly, curl still fails even though the new and known-correct host = key is in the known_hosts file. >>=20 >> So, what do I need to do to get curl to find the new host key in the = updated known_hosts file? >>=20 >> Or, do I have this completely wrong and need to do something = completely different? >>=20 >> Thanks in advance, >>=20 >> Mike Newman >> Korat, Thailand >>=20 >>=20 >> --=20 >> Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users >> Etiquette: https://curl.se/mail/etiquette.html > --=20 > Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users > Etiquette: https://curl.se/mail/etiquette.html --Apple-Mail=_296BD8DB-1331-4788-B686-A1CBE0974474 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html aria-label=3D"message body"><head><meta http-equiv=3D"content-type" = content=3D"text/html; charset=3Dutf-8"></head><body = style=3D"overflow-wrap: break-word; -webkit-nbsp-mode: space; = line-break: after-white-space;">Thank you for the advice. The scripts = are all systemd jobs executed by the user pi. <div><br></div><div>I = wrote a test script using sftp instead of curl and it works fine. No = authentication problems.</div><div><br></div><div>So, I guess I=E2=80=99ll= rewrite all four scripts (one per machine) to use sftp and give = up on curl.</div><div><br></div><div>I contacted the web host to ask why = the host keys changed. They had no clue and promised to get back to me = but that was over 12 hours = ago.</div><div><br></div><div><div><br><blockquote type=3D"cite"><div>On = Mar 19, 2026, at 04:46, Bastian Jesuiter via curl-users = <[email protected]> wrote:</div><br = class=3D"Apple-interchange-newline"><div><div dir=3D"auto">Hi, <div = dir=3D"auto"><br></div><div dir=3D"auto">In general please be really = careful with accepting new host keys. </div><div = dir=3D"auto"><br></div><div dir=3D"auto">The host keys should not change = in normal circumstances ever. </div><div dir=3D"auto">Did you = reinstall your raspi? </div><div dir=3D"auto"><br></div><div = dir=3D"auto">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. </div><div dir=3D"auto"><br></div><div = dir=3D"auto">Depending on which user the curl is called with, the "known = hosts" file changes. </div><div dir=3D"auto"><br></div><div = dir=3D"auto">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. </div><div dir=3D"auto"><br></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:[email protected]">[email protected]</a>> = wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 = .8ex;border-left:1px #ccc solid;padding-left:1ex">Please understand that = I am a naive user who understands very little of how this all works.<br> <br> 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.<br> <br> Suddenly at about 3:08 PM today (Thailand time) all of the uploads began = failing 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"noreferrer noreferrer" target=3D"_blank">mydomain.com</a> port = 22: Connection refused<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 = 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.<br> <br> Sadly, curl still fails even though the new and known-correct host key = is in the known_hosts file.<br> <br> So, what do I need to do to get curl to find the new host key in the = updated known_hosts file?<br> <br> Or, do I have this completely wrong and need to do something completely = different?<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/mailman/listinfo/curl-users</a><br= > Etiquette: <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> -- <br>Unsubscribe: = https://lists.haxx.se/mailman/listinfo/curl-users<br>Etiquette: = https://curl.se/mail/etiquette.html<br></div></blockquote></di= v><br></div></body></html>= --Apple-Mail=_296BD8DB-1331-4788-B686-A1CBE0974474-- --Apple-Mail=_9AFBA280-7877-4571-8DE9-1575C53AE733 Content-Disposition: attachment; filename=smime.p7s Content-Type: application/pkcs7-signature; name=smime.p7s Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCCAzAw ggMsMIICFKADAgECAgpnUv530PgvBlmJMA0GCSqGSIb3DQEBCwUAMEQxFDASBgNVBAMTC01pa2Ug TmV3bWFuMR8wHQYJKoZIhvcNAQkBFhBtZ25ld21hbkBtYWMuY29tMQswCQYDVQQGEwJUSDAeFw0y MzAxMTEwMjA0MjdaFw0yODAxMTEwMjA0MjdaMEQxFDASBgNVBAMTC01pa2UgTmV3bWFuMR8wHQYJ KoZIhvcNAQkBFhBtZ25ld21hbkBtYWMuY29tMQswCQYDVQQGEwJUSDCCASIwDQYJKoZIhvcNAQEB BQADggEPADCCAQoCggEBANf2LFbtIBs7cqOAhfJIUX8zmyVagVcsWYhmBNhcbW11lEPsvWeaXuaG bL93W5e/ihS4kddNTDA6G5s2nuFBNN+n2maQFARo0FNokiVgxIM1AQovVuqXM23vtviMoYghSf2B py4yAW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1Z3RJSmm8rvgeqoywuXUVNHYWcRlwajBObSimqxQN/96r/s8B15Pb/RxiNBWEArpKEwZ mw8vbFK2m6mwFM7vVfanoibhmxXDPzLEEfyZyFf02eweX2k7N4WQiiH/VuhfI3Cxnxw3K2FoFgxl fkjN5ylaJTly5eYql/InGZzFxiXoci5KY4EWJD+S1CUNRklXRPitAQbpHalG+TFTEdh65tsAAAAA AAA= --Apple-Mail=_9AFBA280-7877-4571-8DE9-1575C53AE733-- --===============2532857683047749099== 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 --===============2532857683047749099==--