経由で所有者とグループを設定しようrsyncとしていますが、機能していないようです。
これはコマンドです:
sudo rsync -rlptDvz --owner=cmsseren --group=cmsseren /home/serena/public_html/ -e ssh root@ip:/home/cmsseren/public_html2/
ファイルは正しく同期されますが、所有者とグループは変更されていないようです。
経由で所有者とグループを設定しようrsyncとしていますが、機能していないようです。
これはコマンドです:
sudo rsync -rlptDvz --owner=cmsseren --group=cmsseren /home/serena/public_html/ -e ssh root@ip:/home/cmsseren/public_html2/
ファイルは正しく同期されますが、所有者とグループは変更されていないようです。
回答:
正常に動作しているようです。--ownerおよび--groupを使用して、所有者名とグループ名を保持します(設定しません)...転送後に変更したくないことを意味します。
これらのオプションを使用しない場合、ユーザーとグループは受信側の呼び出しユーザーに変更されます。他のユーザーを指定する場合はchown、スクリプトにコマンドを追加する必要があります。
-o, --owner
This option causes rsync to set the owner of the destination file to be
the same as the source file, but only if the receiving rsync is being run
as the super-user (see also the --super and --fake-super options). Without
this option, the owner of new and/or transferred files are set to the invoking
user on the receiving side...
-g, --group
This option causes rsync to set the group of the destination file to be the same as
the source file. If the receiving program is not running as the super-user (or if
--no-super was specified), only groups that the invoking user on the receiving side
is a member of will be preserved. Without this option, the group is set to the default
group of the invoking user on the receiving side...
ssh root@ip 'chown -R cmsseren:cmsseren /home/serena/public_html2/*'
rsyncのバージョン3.1.0では、Thomasが導入--usermapおよび--groupmap言及され--chownていますが、シナリオに適した便利なオプションも導入されています。
--chown=USER:GROUP
This option forces all files to be owned by USER with group GROUP.
This is a simpler interface than using --usermap and --groupmap directly,
but it is implemented using those options internally, so you cannot mix them.
If either the USER or GROUP is empty, no mapping for the omitted user/group will
occur. If GROUP is empty, the trailing colon may be omitted, but if USER is
empty, a leading colon must be supplied.
If you specify "--chown=foo:bar, this is exactly the same as specifying
"--usermap=*:foo --groupmap=*:bar", only easier.
また、-oと-gオプションが必要です。それらを除外すると、それぞれの属性の更新に失敗しますが、エラーは発生しません。
rsync -og --chown=cmsseren:cmsseren [src] [dest]
これは、オプションが「を使用して内部で実装されている」と述べているマンページで間接的に言及されてい--chownます。--usermap--groupmap
以下のために
--usermapオプションがどんな効果を持っている、-o(--owner)オプションを使用(または暗示)、および受信機は(も参照のスーパーユーザーとして実行する必要がありますする必要があります--fake-superオプション)。ための
--groupmapオプションは、任意の効果を有すること、-g(--groups)オプションが使用される(または暗示)、受信機は、そのグループを設定する権限を持っている必要がありますされなければなりません。
--chownことを言及してよいでしょう--owner(--super)および--group必要とされています」。
別の解決策は、rsyncを使用して接続を確立するリモートユーザーを変更すること--rsync-pathです。完全な説明をここに投稿しました: