[....short answer...]

There is nothing special.  It is ssh-101.  You need passwordless ssh set up 
as a prerequisite for rsync-over-ssh to work.  Nothing weewx-specific at 
all there.

[...longer answer...]

Simplest test is to ssh into the remote host using the private key of the 
user you want weewx to rsync as. The incantation should be
      "ssh -i /var/www/weewx/.ssh/weewx_account_private_key_filename_here 
my.host.com date"  
to try to ssh in and run the date command on the far side, possibly adding 
the -v switch to provide more debugging if it doesn't work right away.

(obviously edit in your actual filename and remote hostname or ip address 
above)

I don't run the apt variant, so if you run this as other than user 'weewx' 
you should (should) get a permission denied even trying to read the weewx 
user's private key as any other non-privileged user.  If you run "sudo 
bash" to open a root shell first and 'then'  the test above, it should work 
hopefully if your keys are set up correctly in weewx's .ssh tree.   You'll 
likely get a prompt asking you to accept the remote side's host key into 
that .ssh tree's known_hosts file.

I don't remember what weewx's rsync defaults are but I personally always 
fully specify everything just to be sure I know what it's going to do 
rather than relying on app defaults.

So from weewx.conf:
        # 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.

Meaning.....you might need a /var/lib/weewx/.ssh/config file entry for your 
remote system.

Mine looks like the following, FWIW:

Host myhostname.domain.com nnn.nnn.nnn.nnn          <= edit
 IdentityFile ~/.ssh/my_private_key_filename        <= edit
 user remote_user_on_server                         <= edit
 hostname nnn.nnn.nnn.nnn                           <= edit

I put the FQDN and ip addresses in there mainly for historical reasons and 
use the ip address in weewx.conf so I don't need to rely on DNS working.

   [[RSYNC]]
        delete = 0
        skin = Rsync
        enable = true
        server = nnn.nnn.nnn.nnn                           <= edit (ip 
address or FQDN here)
        user = remote_user_on_server                       <= edit
        path = /server_side/full/path/to/rsync/into        <= edit
        log_success = false
        log_failure = true
 
Hope this helps.  Basically if you can ssh in as the weewx user using "its" 
private key you specified in its .ssh/config file, rsync should work too.

On Tuesday, May 13, 2025 at 3:47:48 PM UTC-7 Shane Burkhardt wrote:

> I apologize if similar questions have been posted before, but I have not 
> found anything recent and am really banging my head against the wall. I 
> have rsync set-up but it still prompts for passwords for weewx or root 
> users, although the key pair works fine for me as user. I have run keygen 
> as weewx and as root. It looks like it saves root in the /root/.ssh 
> directory but it saves weewx in the /var/lib/weewx/.ssh directory. I have 
> copied the relevant public keys to the authorized keys file for the user on 
> the remote server I am connecting to. Still no luck. I saw very old 
> postings about a config file, but cannot figure out what that is or find 
> recent documentation of what that might be or where that should go. 
>
> Any help would be much appreciated!
>
> I am running weewx on Ubuntu 24.02.02 VM installed via APT. It is using 
> the weewx user to run. My weather station is a WS5000-IP connected through 
> the GX1000 driver. The Weewx version is 5.10. 
>
> Here is a snippet from the log:
> May 13 15:00:23 asok weewxd[81319]: ERROR weeutil.rsyncupload: rsync 
> reported errors. Original command: ['rsync', '--archive', '--stats', '-e', 
> 'ssh', '/var/www/weewx>
> May 13 15:00:23 asok weewxd[81319]: ERROR weeutil.rsyncupload: **** 
> Permission denied, please try again.
> May 13 15:00:23 asok weewxd[81319]: ERROR weeutil.rsyncupload: **** 
> Permission denied, please try again.
> May 13 15:00:23 asok weewxd[81319]: ERROR weeutil.rsyncupload: **** 
> [email protected]: Permission denied (publickey,password).
> May 13 15:00:23 asok weewxd[81319]: ERROR weeutil.rsyncupload: **** rsync: 
> connection unexpectedly closed (0 bytes received so far) [sender]
> May 13 15:00:23 asok weewxd[81319]: ERROR weeutil.rsyncupload: **** rsync 
> error: unexplained error (code 255) at io.c(232) [sender=3.2.7]
> May 13 15:00:25 asok weewxd[81319]: DEBUG user.gw1000: Next update in 5 
> seconds
>
>
>
>

-- 
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 visit 
https://groups.google.com/d/msgid/weewx-user/5e046c6f-3828-4f83-bcda-9e024e71b3c0n%40googlegroups.com.

Reply via email to