Greetings! Thank you for logging these steps last year: 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 <https://groups.google.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 :)
I'm stuck between 6 and 7 and unsure what I'm doing wrong. My logs are below. I've copied the public key from the 'root' user and verified on my paid web hosting site that they have the same key even with 'root'. I can SSH in, but the host is still asking for a password - only if I enter the password am I able to authenticate. It's as-if either side isn't seeing the key. I'm assuming that's my problem with rsync. The logs: _______ Jun 01 19:18:18 rpi systemd[1]: Started weewx.service - WeeWX. Jun 01 19:18:18 rpi weewxd[200894]: INFO __main__: Initializing weewxd version 5.0.2 Jun 01 19:18:18 rpi weewxd[200894]: INFO __main__: Command line: /usr/share/weewx/weewxd.py /etc/weewx/weewx.conf Jun 01 19:18:18 rpi weewxd[200894]: INFO __main__: Using Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] Jun 01 19:18:18 rpi weewxd[200894]: INFO __main__: Located at /usr/bin/python3 Jun 01 19:18:18 rpi weewxd[200894]: INFO __main__: Platform Linux-6.6.20+rpt-rpi-2712-aarch64-with-glibc2.36 Jun 01 19:18:18 rpi weewxd[200894]: INFO __main__: Locale: 'en_GB.UTF-8' Jun 01 19:18:18 rpi weewxd[200894]: INFO __main__: Entry path: /usr/share/weewx/weewxd.py Jun 01 19:18:18 rpi weewxd[200894]: INFO __main__: WEEWX_ROOT: /etc/weewx Jun 01 19:18:18 rpi weewxd[200894]: INFO __main__: Configuration file: /etc/weewx/weewx.conf Jun 01 19:18:18 rpi weewxd[200894]: INFO __main__: User module: /etc/weewx/bin/user Jun 01 19:18:18 rpi weewxd[200894]: INFO __main__: Debug: 0 Jun 01 19:18:18 rpi weewxd[200894]: INFO weewx.engine: Loading station type GW1000 (user.gw1000) Jun 01 19:18:18 rpi weewxd[200894]: INFO user.gw1000: GatewayDriver: version is 0.6.1 Jun 01 19:18:18 rpi weewxd[200894]: INFO user.gw1000: device address is 192.168.7.206:45000 Jun 01 19:18:18 rpi weewxd[200894]: INFO user.gw1000: poll interval is 20 seconds Jun 01 19:18:18 rpi weewxd[200894]: INFO user.gw1000: GatewayService: version is 0.6.1 Jun 01 19:18:18 rpi weewxd[200894]: INFO user.gw1000: device address is 192.168.7.206:45000 Jun 01 19:18:18 rpi weewxd[200894]: INFO user.gw1000: poll interval is 20 seconds Jun 01 19:18:18 rpi weewxd[200894]: INFO weewx.engine: StdConvert target unit is 0x1 Jun 01 19:18:18 rpi weewxd[200894]: INFO weewx.wxservices: StdWXCalculate will use data binding wx_binding Jun 01 19:18:18 rpi weewxd[200894]: INFO weewx.engine: Archive will use data binding wx_binding Jun 01 19:18:18 rpi weewxd[200894]: INFO weewx.engine: Record generation will be attempted in 'software' Jun 01 19:18:18 rpi weewxd[200894]: INFO weewx.engine: Using archive interval of 300 seconds (software record generation) Jun 01 19:18:18 rpi weewxd[200894]: INFO weewx.restx: StationRegistry: Station will be registered. Jun 01 19:18:18 rpi weewxd[200894]: INFO weewx.restx: Wunderground: Posting not enabled. Jun 01 19:18:18 rpi weewxd[200894]: INFO weewx.restx: PWSWeather: Data for station PROOF0FHUMBOLDT will be posted Jun 01 19:18:18 rpi weewxd[200894]: INFO weewx.restx: CWOP: Posting not enabled. Jun 01 19:18:18 rpi weewxd[200894]: INFO weewx.restx: WOW: Posting not enabled. Jun 01 19:18:18 rpi weewxd[200894]: INFO weewx.restx: AWEKAS: Posting not enabled. Jun 01 19:18:18 rpi weewxd[200894]: INFO user.mqtt: service version is 0.24 Jun 01 19:18:18 rpi weewxd[200894]: INFO weewx.restx: MQTT: No config info. Skipped. Jun 01 19:18:18 rpi weewxd[200894]: INFO weewx.engine: 'pyephem' detected, extended almanac data is available Jun 01 19:18:18 rpi weewxd[200894]: INFO __main__: Starting up weewx version 5.0.2 Jun 01 19:18:18 rpi weewxd[200894]: INFO weewx.engine: Using binding 'wx_binding' to database 'weewx.sdb' Jun 01 19:18:18 rpi weewxd[200894]: INFO weewx.manager: Starting backfill of daily summaries Jun 01 19:18:18 rpi weewxd[200894]: INFO weewx.manager: Daily summaries up to date Jun 01 19:18:18 rpi weewxd[200894]: INFO weewx.engine: Starting main packet loop. Jun 01 19:18:18 rpi weewxd[200894]: INFO user.gw1000: Using 't_rainyear' for rain total Jun 01 19:18:18 rpi weewxd[200894]: INFO user.gw1000: skipping rain measurement of 282.6: no last rain Jun 01 19:18:19 rpi weewxd[200894]: INFO user.gw1000: Using 't_rainyear' for rain total Jun 01 19:18:19 rpi weewxd[200894]: INFO user.gw1000: skipping rain measurement of 282.6: no last rain Jun 01 19:20:19 rpi weewxd[200894]: INFO weewx.manager: Added record 2024-06-01 19:20:00 CDT (1717287600) to database 'weewx.sdb' Jun 01 19:20:19 rpi weewxd[200894]: INFO weewx.manager: Added record 2024-06-01 19:20:00 CDT (1717287600) to daily summary in 'weewx.sdb' Jun 01 19:20:20 rpi weewxd[200894]: INFO weewx.restx: PWSWeather: Published record 2024-06-01 19:20:00 CDT (1717287600) Jun 01 19:20:20 rpi weewxd[200894]: INFO weewx.cheetahgenerator: Generated 8 files for report SeasonsReport in 0.58 seconds Jun 01 19:20:21 rpi weewxd[200894]: INFO weewx.imagegenerator: Generated 18 images for report SeasonsReport in 0.23 seconds Jun 01 19:20:21 rpi weewxd[200894]: INFO weewx.reportengine: Copied 5 files to /var/www/html/weewx Jun 01 19:20:21 rpi weewxd[200894]: INFO weewx.cheetahgenerator: Generated 6 files for report SmartphoneReport in 0.05 seconds Jun 01 19:20:21 rpi weewxd[200894]: INFO weewx.imagegenerator: Generated 6 images for report SmartphoneReport in 0.05 seconds Jun 01 19:20:21 rpi weewxd[200894]: INFO weewx.reportengine: Copied 6 files to /var/www/html/weewx/smartphone Jun 01 19:20:21 rpi weewxd[200894]: INFO weewx.cheetahgenerator: Generated 1 files for report MobileReport in 0.02 seconds Jun 01 19:20:21 rpi weewxd[200894]: INFO weewx.imagegenerator: Generated 4 images for report MobileReport in 0.03 seconds Jun 01 19:20:21 rpi weewxd[200894]: INFO weewx.reportengine: Copied 2 files to /var/www/html/weewx/mobile Jun 01 19:20:21 rpi weewxd[200894]: INFO weewx.cheetahgenerator: Generated 13 files for report StandardReport in 0.50 seconds Jun 01 19:20:22 rpi weewxd[200894]: INFO weewx.imagegenerator: Generated 12 images for report StandardReport in 0.11 seconds Jun 01 19:20:22 rpi weewxd[200894]: INFO weewx.reportengine: Copied 13 files to /var/www/html/weewx Jun 01 19:20:22 rpi weewxd[200894]: INFO user.belchertown: version 1.3.1 Jun 01 19:20:23 rpi weewxd[200894]: INFO weewx.cheetahgenerator: Generated 12 files for report Belchertown in 1.06 seconds Jun 01 19:20:23 rpi weewxd[200894]: INFO weewx.reportengine: Copied 39 files to /var/www/html/weewx/belchertown Jun 01 19:20:23 rpi weewxd[200894]: ERROR weeutil.rsyncupload: rsync reported errors. Original command: ['rsync', '--archive', '--stats', '--delete', '-e', 'ssh -p 65002', '/var/www/html/weewx/belchertown/', 'USERidREDACTED@IP_ADDRESS:public_html'] Jun 01 19:20:23 rpi weewxd[200894]: ERROR weeutil.rsyncupload: **** Host key verification failed. Jun 01 19:20:23 rpi weewxd[200894]: ERROR weeutil.rsyncupload: **** rsync: connection unexpectedly closed (0 bytes received so far) [sender] Jun 01 19:20:23 rpi weewxd[200894]: ERROR weeutil.rsyncupload: **** rsync error: unexplained error (code 255) at io.c(231) [sender=3.2.7] ^C ___________ Manually coping the html files work after entering the password, but who wants to do that every five minutes :) "Host key verification failed" is obviously my problem but cannot figure it out. Any pointers, directions or well-wishes would be greatly appreciated! Almost there...... Thanks! On Friday, July 21, 2023 at 5:14:24 AM UTC-5 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 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/ >>> ace...@external.domain.com: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 weewx-user+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/161208fd-dcca-430c-a250-999a253e02e1n%40googlegroups.com.