Neil Krupa
Neil Krupa

Reputation: 1

Allow only root to untar a .tar.gz file linux

I am looking for a way to allow only an administrator to untar a file.

I have found other posts that change the permissions of the enclosed files in the archive but not the file its-self. As well as this I have tried to set user permissions using chown and chmod, which will work until the file is moved to another system where the permissions are not persisted.

Is there a way for a tar.gz file to have permissions set to only allow an admin user to untar it, with these permissions being persisted?

Thanks!

Upvotes: 0

Views: 325

Answers (1)

Romeo Ninov
Romeo Ninov

Reputation: 7225

No, there is no such way. The tar (or compressed tar.gz, tar.Z) file is container of other files inside. The same is true about compression, it just apply algorithm to the original file to compress (or decompress it).

You can do few things:

  1. Play with permissions, set 000 and only root will be able to read the file.
  2. Switch to zip with password and provide the password on "need to know" basis
  3. Tar and compress it and then encrypt it and provide the password on "need to know" basis

Upvotes: 1

Related Questions