Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve file UID/GID when creating an archive #108

Open
cristianrgreco opened this issue Jul 14, 2023 · 1 comment
Open

Preserve file UID/GID when creating an archive #108

cristianrgreco opened this issue Jul 14, 2023 · 1 comment

Comments

@cristianrgreco
Copy link

cristianrgreco commented Jul 14, 2023

Hello

I'm having an issue preserving the UID/GID of a file in an archive.

For example, I have the file /tmp.test.txt which has a UID/GID of 1250:1250:

➜  ls -n ~/tmp/test.txt
-rw-r--r--  1 1250  1250  0 13 Jul 10:31 /tmp/test.txt

I am creating a tar with this file, but when I inspect it, the UID/GID has been set to 0:0:

const tar = archiver("tar");
tar.file("/tmp.test.txt", { name: "/tmp/test.txt" });
tar.finalize();
tar.pipe(fs.createWriteStream("/tmp/test.tar"));
➜  tar --numeric-owner -tvf /tmp/test.tar
-rw-r--r--  0 0      0           0 13 Jul 10:31 tmp/test.txt

My understanding is that a tar archive should preserve file ownership information. Apologies if I've misunderstood/missing something. Any help appreciated

@javierlopezdeancos
Copy link

Something to notice is, if the UID/GID change to 0:0 then is changing to superuser 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants