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.

관련 정보