0

I created a tar.gz file using tar -cf file_1.tar command. But, when I use strings file_1.tar, I see:

file
0000644
0001750
0001750
00000000000
014545
ustar  
arian
arian

How can I remove them?

2
  • An attempt to "remove" them makes no sense. They are integral parts of files packed into the tar file. If you "remove" them, you'll damage the file.
    – raj
    Sep 20, 2021 at 22:54
  • You can't just remove random parts of the file. The data is there for a reason. It's obvious and self-understanding, nothing more to explain here. It's like you tear out several pages from a book and expect the book to be still complete and intact.
    – raj
    Sep 20, 2021 at 23:07

1 Answer 1

1

strings represents any plain text within the binary file, you should encrypt your tar file to hide its contents.

You can either use GPG with tar directly, like in this answer.

Encrypt:

tar czvpf - file1.txt file2.pdf file3.jpg \
 | gpg --symmetric --cipher-algo aes256 -o myarchive.tar.gz

Decrypt:

gpg -d myarchive.tar.gz.gpg | tar xzvf -

Or you might want to consider storing your tar file using p7zip, which could be useful for compatibility with other operating systems using p7zip or 7-Zip. The reason you recompress the tar file is to preserve the unix permissions that ZIP files don't have compatibility for.

Install it first

sudo apt install p7zip-full

Encrypt:

7z a -p -mx=0 -mhe -t7z test.7z test.tar

When you run the encrypt command a prompt will ask you for the password you want to use.

Decrypt:

7z x test.7z

For more info on what these switches mean, see this guide.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.