Hot answers tagged

3

Any existing tarballs can be sanitized via something like: #!/usr/bin/env perl use strict; use warnings; use Archive::Tar 1.80; for my $tarfile (@ARGV) { my $tar = Archive::Tar->new($tarfile) // die "failed to read '$tarfile'\n"; for my $archivefile ($tar->list_files) { $tar->chown($archivefile, 'root:root'); } my ...


2

You can fool tar into treating the files as if they have a different owner with fakeroot. Fakeroot runs a command in an environment were it appears to have root privileges for file manipulation, by setting LD_PRELOAD to a library with alternative versions of getuid(), stat(), etc. This is useful for allowing users to create archives (tar, ar, .deb .rpm ...


2

Generally .tar.gz is a usable file distribution format. GNU tar allows you to replace owner, group and permissions with other values when adding files to the archive. $ tar -c -f archive.tar --owner=0 --group=0 . https://www.gnu.org/software/tar/manual/html_section/tar_33.html#SEC69 If your version of tar does not support the GNU options you can copy ...


2

With GNU you can use --numeric-owner to prevent tar from storing your username. Alternatively, you can set another userid with --owner=ID. When it's extracted, those user ids will be dropped, unless the extractor is the root user. A common way used to bundle files is cpio which is typically used with the --no-preserve-owner option. This is how rpm files ...



Only top voted, non community-wiki answers of a minimum length are eligible