Cómo configurar el propietario de los archivos tar y su contenido como usuario actual

Cómo configurar el propietario de los archivos tar y su contenido como usuario actual

Necesito configurar el propietario de los archivos tar y su contenido como usuario actual.

Recibiré archivos del usuario FOO en la carpetaarchivos_config/billing/xml/incommingBills Quiero establecer el propietario como usuario actual, es decir, BAR cada vez que se copia un archivo tar en esta ubicación. También desea que el contenido del archivo tar se establezca como BAR.

Respuesta1

Si se refiere al tararchivo en sí, el propietario del archivo o el usuario root deben hacerlo chown newusername /path/to/file. O usted, si tiene acceso de superusuario, puede hacerlo sudo chown $(whoami) /path/to/file.

Si está hablando de información de propiedad contenidadentroel tararchivo, me remitiré al manual:

 -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.

información relacionada