Hi all,
Facing same issue with *ERROR weeutil.rsyncupload: Host key
verification failed *error.
However, it's really strange...
I can ssh to remote site as both *root* as well as *pi* user
I can do manual rsync with no problems but weewx builtin rsync returns
above error
At the moment my weewx installation is syncing using cron with no problems
but I want to understand why builtin rsync fails
Problem started after upgrade from weewx 5.0.0 to 5.0.1
Any ideas?
Thank you forward :-)
On Friday, July 21, 2023 at 1:14:24 PM UTC+3 Tomasz Lewicki wrote:
> Thank you for replies.
>
> @Warren Gill: yes, I was thinking about crontab but wanted to use built-in
> solution. Of course crontab is good as backup solution.
>
> @vince: you're right, I didn't think about it from this side. Just for
> record for future seekers:
>
> 1. I logged as root ('sudo -i' from 'pi' account)
> 2. generated SSH keys ('ssh-keygen')
> 3. copied them to external server ('ssh-copy-id ace...@external.domain.com
> -p 222')
> 4. copied /home/pi/.ssh/config to /root/.ssh/config
> 5. changed owner of 'config' ('chown root:root /root/.ssh/config')
> 6. waited for next synchronization
> 7. smiled because everything worked as expected :)
>
> czwartek, 20 lipca 2023 o 23:24:20 UTC+2 vince napisał(a):
>
>> Unless you did something custom, weewx runs as root, not as user 'pi'.
>>
>> You need 'root' to be able to ssh into the remote system with the
>> user+key you specified. Same procedure you did to get 'pi' to work, just
>> do it after sudo(ing) to root so you set the 'root' account up similiarly.
>> Two minute thing to do.
>>
>> On Thursday, July 20, 2023 at 1:06:54 PM UTC-7 Tomasz Lewicki wrote:
>>
>>> rsync: host key verification failed
>>>
>>> Dear Weewx users.
>>>
>>> I'm trying to send files generated by Weewx to external webserver (paid
>>> hosting) with rsync. I'm familiar with rsync, ssh and Linux. Weewx is
>>> running on Raspberry Pi as 'pi' user. Here are my configs:
>>>
>>> /home/pi/.ssh/config
>>>
>>> Host CF
>>> #HostName external.domain.com <- here of course is real web address
>>> HostName 10.20.30.40 <- here of course is real IP
>>> Port 222
>>> User acetone <- this is my username on remote webserver (hosting)
>>>
>>> /etc/weewx/weewx.conf
>>>
>>> (...)
>>>
>>> [[RSYNC]]
>>> # rsync'ing to a webserver is treated as just another report
>>> skin = Rsync
>>>
>>> # If you wish to use rsync, you must configure passwordless ssh
>>> using
>>> # public/private key authentication from the user account that
>>> weewx
>>> # runs to the user account on the remote machine where the files
>>> # will be copied.
>>> #
>>> # If you wish to use rsync, set "enable" to "true", then
>>> # fill out server, user, and path.
>>> # The server should appear in your .ssh/config file.
>>> # The user is the username used in the identity file.
>>> # The path is the destination directory, such as
>>> /var/www/html/weather.
>>> # Be sure that the user has write permissions on the destination!
>>> enable = true
>>> server = external.domain.com
>>> port = 222
>>> user = acetone
>>> path = domains/external.domain.com/private_html/meteo/
>>>
>>> # To upload files from something other than what HTML_ROOT is set
>>> # to above, specify a different HTML_ROOT here.
>>> #HTML_ROOT = /var/www/html/weewx
>>>
>>> # Rsync can be configured to remove files from the remote server
>>> if
>>> # they don't exist under HTML_ROOT locally. USE WITH CAUTION: if
>>> you
>>> # make a mistake in the remote path, you could could
>>> unintentionally
>>> # cause unrelated files to be deleted. Set to 1 to enable remote
>>> file
>>> # deletion, zero to allow files to accumulate remotely.
>>> delete = 0
>>>
>>> (...)
>>>
>>> I can log in to external server with ssh (passwordless) with command:
>>>
>>> $ ssh -p 222 ace...@external.domain.com
>>>
>>> or just
>>>
>>> $ ssh CF <- this is host from .ssh/config
>>>
>>> I got error message from weewx:
>>>
>>> Jul 20 21:36:04 WeewxFR24 weewx[28079] DEBUG weeutil.rsyncupload:
>>> rsyncupload: cmd: [['rsync', '--archive', '--stats', '-e', 'ssh -p 222',
>>> '/var/www/html/weewx/', 'ace...@external.domain.com:~/domains/
>>> external.domain.com/private_html/meteo']]
>>> Jul 20 21:36:04 WeewxFR24 weewx[28079] ERROR weeutil.rsyncupload: rsync
>>> reported errors. Original command: ['rsync', '--archive', '--stats', '-e',
>>> 'ssh -p 222', '/var/www/html/weewx/', 'ace...@external.domain.com:~/domains/
>>> external.domain.com/private_html/meteo']
>>> Jul 20 21:36:04 WeewxFR24 weewx[28079] ERROR weeutil.rsyncupload:
>>> Host key verification failed.
>>> Jul 20 21:36:04 WeewxFR24 weewx[28079] ERROR weeutil.rsyncupload:
>>> rsync: connection unexpectedly closed (0 bytes rec