無法 rsync 到 /etc 中的目標

無法 rsync 到 /etc 中的目標

從 Debian 10 升級到 11 後,/etc 中某個目標的 rsync 作業不再運作。

在伺服器(目標)端我有這個:

uid = root
gid = root

hosts allow = mysender

[mymodule]
  # NOGO
  path = /etc/tmp

  # GO
  # path = /root/tmp

  comment = Just for testing
  read only = false

在客戶端(來源)我輸入以下命令:

rsync -a /etc/temp/test myserver::mymodule

這使得 rsync 失敗並顯示以下訊息:

rsync: [generator] recv_generator: mkdir "/test" (in mymodule) failed: Read-only file system (30)
*** Skipping any contents from this failed directory ***
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1333) [sender=3.2.3]

將伺服器配置為使用 /etc 之外的路徑(例如 /root/tmp)確實可以按預期工作。

根檔案系統(也包含 /etc 目錄)是不是當然是唯讀安裝的,而且它是乾淨的。為什麼 rsyncd 認為 /etc 是唯讀檔案系統的一部分?

答案1

rsync 版本 3.2.0-1 引入了一項稱為「ProtectSystem」的增強功能,除其他外,它可以防止對/etc(請參閱https://download.samba.org/pub/rsync/NEWS)。這可以透過建立/etc/systemd/system/rsync.service.d/override.conf包含以下內容的文件來覆蓋:

[Service]
ProtectSystem=off

希望這對您在初次發文後很長一段時間內有所幫助。

相關內容