On Wednesday, February 1, 2023 at 2:12:39 PM UTC-5 [email protected] 
wrote:
> Again, I had no success by configuring weewx.conf - the error message was 
concerning the public and 
> private keys (host key verification failed - rsync upload unexplained 
error (code 255).. I was trying as root, 
> and I can SSH into the server without a password having set up the keys 
from the Raspberry Pi. I've done a 
> botch to get round it by running rsync as a cron job at 01 and 31 past 
each hour and that works OK. 
> "rsync -a /var/www/html/weewx/ [email protected]:/var/www/.../weewx/".

rsync is a bit fiddly.  it depends on ssh for the actual connections, and 
ssh, though powerful, has so many options that you've got to get it just 
right.  since rsync uses ssh, it is best to test your connection first 
using ssh.  if that works, then rsync will work; use ssh manually to test 
the connection, then use rsync manually to make sure you are syncing the 
right files/directories.

there are basically two contexts in which you can specify ssh options:

1) the ssh config file for the user who invokes ssh.  this is nominally 
located at ~/.ssh/config
2) command-line

i find it easiest to test using command-line, then when you have it 
working, but the options into the config file and remove them from 
command-line.  the ssh options you specify in the weewx config file are 
basically ssh command-line (or rsync command-line) options.

for example, the most basic invocation would be:

ssh [email protected] -i /path/to/id_rsa

you can specify other ssh options using the -o, for example:

ssh [email protected] -i /path/to/id_rsa -o 
StrictHostKeyChecking=no

if you put all of this into the ssh config file, then you can simplify:

Host provider
   HostName provider.example.com
   User username
   IdentityFile /path/to/id_rsa
   StrictHostKeyChecking no

so that the actual invocation is then:

ssh provider

and your rsync will just work, assuming that you got the source and 
destination paths right in your rsync config, but that is a separate 
topic.  (be sure that you understand the difference between /path/to/dir/ 
and /path/to/dir - it matters to rsync!)

note that permissions on the keyfile must be readable by owner and not 
readable by anyone else.

one other thing: be sure to establish the ssh connection manually first, as 
the user who runs the crontab or weewx.  that way you can be sure that the 
remote host's key has been accepted.

m

-- 
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/00d9fe5a-14a3-4412-81f5-6a03becc621cn%40googlegroups.com.

Reply via email to