In my weewx.conf I have a section:
[[RSYNC]]
enable = true
server = XYZ # It's only identifier needed for file described below.
Can be anything, for example MY_SECRET_SERVER
path = /path/to/files/on/my/remote/server # for example:
/domains/my-domain/public_html/pws
And in /root/.ssh I have file named simply 'config':
Host XYZ
HostName my.remote.server.com # HostName can be also direct IP address
Port 45678 # Port to SSH if not standard 22
User me # name of your user on remote server
And rsync from inside of Weewx works in my case.
czwartek, 8 lutego 2024 o 09:33:14 UTC+1 Kalju napisał(a):
> 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
>> [email protected] -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 [email protected]
>>>>
>>>> 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/', '[email protected]:~/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/',
>>>> '[email protected]:~/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 received so far) [sender]
>>>> Jul 20 21:36:04 WeewxFR24 weewx[28079] ERROR weeutil.rsyncupload: ****
>>>> rsync error: unexplained error (code 255) at io.c(235) [sender=3.1.3]
>>>>
>>>> I can send single file or whole directory with this command applied
>>>> directly from CLI:
>>>>
>>>> $ rsync --archive --stats -e 'ssh external.domain.com -p 222 -l
>>>> acetone' /var/www/html/weewx/ CF:domains/
>>>> external.domain.com/private_html/meteo/
>>>>
>>>> I can also send files with simpler command (no additional options for
>>>> -e ssh because they are in .ssh/config):
>>>>
>>>> $ rsync --archive --stats -e ssh /var/www/html/weewx/ CF:domains/
>>>> external.domain.com/private_html/meteo/
>>>>
>>>> But *not* with:
>>>>
>>>> rsync --archive --stats -e ssh /var/www/html/weewx/
>>>> [email protected]:domains/
>>>> external.domain.com/private_html/meteo
>>>>
>>>> And *not* with:
>>>>
>>>> rsync --archive --stats -e ssh /var/www/html/weewx/
>>>> external.domain.com:domains/external.domain.com/private_html/meteo
>>>>
>>>> As you can see, if .ssh/config is properly filled with data, it is much
>>>> simpler to 'do' rsync. But why it works when executed manually but not
>>>> from
>>>> inside Weewx? Keys are valid if I can log in without password from CLI.
>>>> Maybe you could do [[RSYNC]] option more flexible and use .ssh/config?
>>>>
>>>
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/ae9074bf-3ec2-443e-bf1a-f659d5127151n%40googlegroups.com.