ターゲットの所有者と権限でRsyncを実行できますか?

ターゲットの所有者と権限でRsyncを実行できますか?

元のサーバーには、ルートという1人の所有者がいます。

----/home/sub1/test1 
----/home/sub2/test1

私のローカルコンピュータはターゲットです。

----/home/sub1/test1 owner by user1
----/home/sub2/test1 owner by user2

ローカル所有者を変更せずに元のサーバーの新しい更新ファイルをローカルコンピュータに同期する方法は?

編集する

フォルダも多く、ローカルコンピュータにも所有者が多いため、1つのコマンドですべてのソースを同期する必要があります。たぶん可能ですか?

ありがとうございます。

ベストアンサー1

移転後に変更したくないようです。

次のコマンドを試してください。

rsync -avr -o -g /source/directory user@:destinationHost/destination/directory

このオプションを使用しない場合、ユーザーとグループは受信側から呼び出すユーザーに変更されます。他のユーザーを指定するには、スクリプトに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...

SEE MAN rsync

おすすめ記事