我正在我的服务器节点上执行一个 cron 作业,该作业使用来自 letsencrypt 的 haproxy 基础连接证书文件。但是,当我在家时,我有相同的 dns 指向实际托管网站的家庭服务器,因此我访问的域是直接通过本地服务器 IP 访问的,我位于同一个共享网络上。由于 certbot 在 digitalocean 上的代理节点服务器上运行,我需要将未连接的证书文件夹 /etc/letsencrypt/live 和 /etc/letsencrypt/archive rsync 到我的家庭服务器
cron 任务以 root 用户身份运行:但是当尝试 rsync 时,它出现权限错误:
# 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" 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]
并且由于我在目标服务器上以 root 身份运行,并且 root 用户确实具有在 /etc/letsencrypt 文件夹上写入的权限,但我仍然收到错误:
#/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/
我该如何修复 rsync 的权限问题?保持目标权限不变,并与源权限匹配