tarファイルの所有者とその内容を現在のユーザーに設定する方法

tarファイルの所有者とその内容を現在のユーザーに設定する方法

tarファイルの所有者とその内容を現在のユーザーに設定する必要があります。

フォルダ内のユーザーFOOからファイルを受け取ります。config_files/billing/xml/incommingBills tarファイルがこの場所にコピーされるたびに、所有者を現在のユーザーであるBARに設定したいと思います。また、tarファイルの内容をBARに設定しようとしています。

ベストアンサー1

ファイル自体に対して作業を実行するには、tarファイル所有者またはルートがファイル所有者である必要がありますchown newusername /path/to/file。または、スーパーユーザーアクセス権がある場合は、次のことができますsudo chown $(whoami) /path/to/file

含まれている所有権情報について話している場合以内にこのtarファイルはマニュアルに従います。

 -o      (x mode) Use the user and group of the user running the program rather than those specified in the archive.  Note that this has no significance unless -p is specified, and the program is being run by the root user.  In this case,
         the file modes and flags from the archive will be restored, but ACLs or owner information in the archive will be discarded.

おすすめ記事