Rsync connection to remote server

468 views
Skip to first unread message

Dun Mac

unread,
Apr 14, 2021, 2:15:12 AM4/14/21
to weewx-user
Hi, 
I have established a direct connection to a web server (GreenGeeks) with the SSH keys added to the remote server. I can log on to the remote server via 
"ssh user...@170.x.xxx.xx" and it logs on with no passwords. 
When I set weewx.conf,  Rsync to true I get the following error message in syslog;

Apr 14 12:00:36 RPi-weather weewx[29143] DEBUG weewx.reportengine: Running report 'RSYNC'
Apr 14 12:00:36 RPi-weather weewx[29143] DEBUG weewx.reportengine: Found configuration file /etc/weewx/skins/Rsync/skin.conf for report 'RSYNC'
Apr 14 12:00:36 RPi-weather weewx[29143] DEBUG weeutil.rsyncupload: rsyncupload: cmd: [['rsync', '--archive', '--stats', '-e ssh', '/var/www/html/weewx/', 'xxx...@107.x.xxx.xx:/home//weewx/wx_standard_report']]
Apr 14 12:00:39 RPi-weather weewx[29143] ERROR weeutil.rsyncupload: [['rsync', '--archive', '--stats', '-e ssh', '/var/www/html/weewx/', 'xxx...@107.x.1xxx.xx:Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).. rsync: connection unexpectedly closexxxd (0 bytes received so far) [sender]. rsync error: unexplained error (code 255) /home/xxxxxxx/weewx/wx_standard_report']] reported errors: xxx...@107.x.xx.xx: at io.c(235) [sender=3.1.3]
Apr 14 12:00:39 RPi-weather weewx[29143] INFO weeutil.rsyncupload: rsync executed in 2.62 seconds

Would someone be kind enough to post their ~/.ssh/config and their /etc/ssh/ssh_config and /etc/ssh/sshd_config files so I can see if I have an error in one of these files with my setup, please. Any other feedback would also be very welcome.
Duncan

Dun Mac

unread,
Apr 14, 2021, 2:42:54 AM4/14/21
to weewx-user
According to the web server the public keys were accepted by the server. They have sent a copy of their logs;
###
Apr 14 03:24:57 ams102 sshd[2890665]: Accepted publickey for offgrid1 from 49.xxx.xxx.xx port 34506 ssh2: RSA SHA256:oMhJCSYLqpgYZ6mYwxcQvedv+hycs5kTOTLfVKhtPRzmGStXdRaHU
Apr 14 03:24:57 ams102 sshd[2890665]: pam_unix(sshd:session): session opened for user oxxxxx1
Apr 14 03:26:42 ams102 sshd[2890665]: pam_unix(sshd:session): session closed for user oxxxxx1

tomn...@frontier.com

unread,
Apr 14, 2021, 9:23:24 AM4/14/21
to weewx-user
Are you testing as your own userID, but weewx is running as root?  From the command line you can add -v or -vv to your ssh command to get a TON of details about the
ssh connection.  Read it slowly and carefully.  Also, you can try the rsync by hand as well.  No point trying to debug it within weewx.

vince

unread,
Apr 14, 2021, 12:54:53 PM4/14/21
to weewx-user
This is rsync 101.    You need the account you are running weewx under (root) to have a ~/.ssh/config file that tells it which key to use to connect to the remote system, as well as which account to use on the remote side.

  IdentityFile ~/.ssh/my_private_key
  user my_remote_username

If you do that, then as root you should be able to rsync to my.remote.host.com and it will log in there as my_remote_username

Dun Mac

unread,
Apr 14, 2021, 8:37:25 PM4/14/21
to weewx-user
This is my ~/.ssh/config file;
Host 107.xxx.xxx.xxx
IdentityFile ~/.ssh/id_rsa
User oxxxx1

When my /etc/ssh/ssh_config file has;
PasswordAuthentication no
the Rsync fails .. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)..

When my /etc/ssh/ssh_config file has;
#PasswordAuthentication no
the rsync (running wee_reports) requests a password and then the transfer proceeds correctly



vince

unread,
Apr 14, 2021, 11:19:49 PM4/14/21
to weewx-user
You should not alter your system-wide /etc/ssh/ssh_config at all and you should never get prompted for a password if you have it set up correctly.

That stanza needs to be in root's ssh config file, which likely is /root/.ssh/config on a pi.   Your weewx.conf file needs to use the same 'server = x.x.x.x' setting that the 'host' entry of root's ssh config file uses.

Dun Mac

unread,
Apr 15, 2021, 12:33:27 AM4/15/21
to weewx-user
Thank you, Vince (once again). I had used my standard login to create the config file and had not created it as the root user. It is now working. 
Reply all
Reply to author
Forward
0 new messages