On Sunday, June 14, 2020 at 12:18:28 PM UTC-4, Ossian wrote:
>
> I am having a similar issue. I keep seeing mention of the need or
> possibility to provide correct keys etc for root to use, but have not found
> anything concrete to go on.
>
there are many ways to do this, for example, one approach is with
command-line arguments, while another approach is to use the ssh config
file.
lets say that you connect to the server 'server.example.com' via rsync as
the user 'weewx' using the credentials in these files:
/home/pi/.ssh/id_rsa_weewx
/home/pi/.ssh/id_rsa_weewx.pub
lets say that you are running weewx as the the user 'root', whose home
directory is /root
1) ensure that root has an ssh directory
sudo mkdir -p /root/.ssh
2) copy the credential files into root's ssh space
sudo cp /home/pi/.ssh/id_rsa_weewx /root/.ssh
sudo cp /home/pi/.ssh/id_rsa_weewx.pub /root/.ssh
3) create the ssh configuration file /home/root/.ssh/config with these
contents:
Host server.example.com
User weewx # this is the username used to connect to the server
IdentityFile /home/root/.ssh/id_rsa_weewx # credentials used to
connect to the server
4) finally, ensure that permissions are correct:
sudo chown root.root /home/root/.ssh
sudo chmod 700 /home/root/.ssh
sudo chmod 600 /home/root/.ssh/config
sudo chmod 600 /home/root/.ssh/id_rsa*
now when the user 'root' attempts a connection to server.example.com, it
will use the correct credentials, no matter how ssh, scp, or rsync is
invoked
if you run weewx as some other, user say 'pi' or 'weewx', then put the
files into that user's .ssh directory instead of root's .ssh directory.
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/9870cfe2-bc51-4e1d-aba1-faa8ba2fd752o%40googlegroups.com.