私はProtectSystem=full
デフォルトでrsyncd 3.2でDebian 11を実行しています。
カバーしたくてsystemctl edit
よくする方です。オーバーレイに追加したい内容は次のとおりです。
### Editing /etc/systemd/system/rsync.service.d/override.conf
### Anything between here and the comment below will become the new contents of the file
[Service]
ProtectSystem=off
### Lines below this comment will be discarded
ログには解析エラーは報告されず、デバイス(私の意見では)は新しい設定にリロードされます。
/etc
ただし、たとえば、特定のパスでrsyncを試みると、まだ「読み取り専用ファイルシステム」エラーが発生します。
この制限を超えることはできません。どうしたの?それともこの制限は問題になりませんか?この設定はDebian 11にアップグレードする前にDebian 10で正常に動作していたため、これがProtectSystem
問題の原因であると思います。
/etc/rsyncd.conf
編集:これは私が使用する設定です。
[nameOfMount]
path = /etc/postfix
auth users = sysadmin
secrets file = /etc/rsyncd.secrets
hosts allow = xxx.xxx.xxx.xxx
read only = false
uid = root
pre-xfer exec = /usr/local/bin/scriptA.sh
post-xfer exec = /usr/local/bin/scriptB.sh
pro / post execスクリプトは、転送されるファイルのバックアップコピーを作成し、postfixデーモンを再ロードします。これらのエラーの例は次のとおりです。
rsync error: requested action not supported (code 4) at clientserver.c(1098) [Receiver=3.2.3]
/bin/cp: cannot create regular file '/etc/postfix/fileName.yyyymmddd': Read-only file system
ベストアンサー1
状態確認から始めましょう。
systemctl show rsync | grep -E 'ProtectSystem|NoNewPrivileges'
変更されていないシステムでは、以下が返されます。
ProtectSystem=full
NoNewPrivileges=yes
NoNewPrivileges
この設定を使用すると、rsyncd
UIDの変更を防ぐことができるため、この現象が発生しました。
それでは、デーモンがいつ再起動したのかを確認してrsync
記録します(私の場合は22:53でした)。
ps -ef | grep '[r]sync --daemon'
root 22600 1 0 22:53 ? 00:00:00 /usr/bin/rsync --daemon --no-detach
オーバーレイに2行を追加すると、
systemctl edit rsync
[Service]
ProtectSystem=off
それから私はこれを得ます
systemctl show rsync | grep -E 'ProtectSystem|NoNewPrivileges'
ProtectSystem=no
NoNewPrivileges=yes
しかし、rsync
デーモンは再起動されません。
ps -ef | grep '[r]sync --daemon'
root 22600 1 0 22:53 ? 00:00:00 /usr/bin/rsync --daemon --no-detach
実際、私はこの作業を手動で行う必要があることを知りました。
systemctl restart rsync
ps -ef | grep '[r]sync --daemon'
root 22770 1 1 22:56 ? 00:00:00 /usr/bin/rsync --daemon --no-detach
ただし、ファイルシステムはまだ読み取り専用モードです。追加の行が必要です。
systemctl edit rsync
[Service]
ProtectSystem=off
NoNewPrivileges=no
その後、再起動してください。
systemctl restart rsync
最終状態の確認、
systemctl show rsync | grep -E 'ProtectSystem|NoNewPrivileges'
私のシステムでは、目的の最終ゲームが返され、次のファイルとディレクトリに書き込むことができます/etc
。
ProtectSystem=no
NoNewPrivileges=no