I am making a cron job on my server node that uses haproxy base concated cert file from letsencrypt. however when I am at home I have same dns pointing to the home server which is actually hosting the website so the domain I access is directly via local server IP me being on same shared network. and since the certbot runs on proxy node server on digitalocean, I need to rsync the uncocatenated cert files folders /etc/letsencrypt/live
and /etc/letsencrypt/archive
to my home server
the cron task runs as root user: but when trying to rsync it gives me permission error:
# rsync -e "sudo ssh -p 5322" -arvzh /etc/letsencrypt/live [email protected]:/etc/letsencrypt/
sending incremental file list
rsync: failed to set times on "/etc/letsencrypt/live": Operation not permitted (1)
rsync: recv_generator: failed to stat "/etc/letsencrypt/live/README": Permission denied (13)
live/
rsync: recv_generator: mkdir "/etc/letsencrypt/live/xyz.com" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
live/xyz.com/
sent 433 bytes received 370 bytes 146.00 bytes/sec
total size is 1.58K speedup is 1.97
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330) [sender=3.2.3]
and since i am running as root and root user on destination server does have privilages to write on the /etc/letsencrypt folder still i get error:
#/etc/letsencrypt# ll
total 52
drwxr-xr-x 9 root root 4096 Aug 10 19:48 ./
drwxr-xr-x 119 root root 12288 Aug 9 22:24 ../
drwx------ 2 root root 4096 Aug 10 19:48 archive/
drwxr-xr-x 2 root root 4096 Aug 1 22:26 csr/
drwx------ 2 root root 4096 Aug 1 22:26 keys/
drwx------ 2 root root 4096 Aug 10 19:48 live/
how can I fix this permission issue to rsync. keeping the destination permission unaltered and match the source
even if I create xyz.com directory with write permission to user, group and other on destination I am still getting the error
sending incremental file list
rsync: ERROR: cannot stat destination "/etc/letsencrypt/live/xyz.com/": Permission denied (13)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(653) [Receiver=3.1.2]