LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-16-2018, 05:52 PM   #1
tomkat0789
LQ Newbie
 
Registered: Sep 2018
Location: Chicago, USA
Distribution: Devuan
Posts: 3

Rep: Reputation: Disabled
Angry Password protect a zip file, not individual files within it


I've zipped a directory with a command like one of these:
Code:
7z a -mhe=on -p asdf.zip test
zip -e asdf.zip test/*
I would expect to be asked for a password when I open the zip file. After entering the password, THEN I can extract all the files and access everything. I (think I) recall doing this with a zip program on Windows at work.

What those two commands actually get me is a zip file that totally exposes its contents, (STOP, see edit) then asks for a password when I open each zipped file. I guess my files are encrypted, but this is annoying because I'm encrypting a large number of files that'd be opened individually in their use. Is there a way to get what I want above? To only be prompted for a password at extraction?

EDIT: I take that back, it doesn't ask for a password after extraction, but I'm still annoyed that all the contents are exposed. What can be done about that?

Apologies if I scrolled past the relevant info on the man pages!

Last edited by tomkat0789; 09-16-2018 at 05:58 PM.
 
Old 09-16-2018, 08:18 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,789

Rep: Reputation: 5951Reputation: 5951Reputation: 5951Reputation: 5951Reputation: 5951Reputation: 5951Reputation: 5951Reputation: 5951Reputation: 5951Reputation: 5951Reputation: 5951
-mhe=on option is not valid for zip files.

The zip file format was created back in the 80s and basically that is how it works. If you want to hide the file names you need to use a different archiving format. The file contents are encrypted just not the names.

Quote:
zip -e asdf.zip test/*
As far as I know you can not encrypt an existing zip file.

I can't say I fully understand your question. If the zip file is password protected then any unzipping program should ask for the password which will extract all files. It is possible to extract single file.

Last edited by michaelk; 09-16-2018 at 08:37 PM.
 
2 members found this post helpful.
Old 09-18-2018, 06:45 PM   #3
tomkat0789
LQ Newbie
 
Registered: Sep 2018
Location: Chicago, USA
Distribution: Devuan
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for the reply, and apologies for garbling the question.

Revised question(s) in light of your response:

1. Is there a better encrypted data storage tool that hides the filenames?
2. Same as 1, but which can I extract and access from a Windows computer?
 
Old 09-18-2018, 06:54 PM   #4
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Using Engrampa on Mint, I can right-click on a file, or series of files, and compress them as a .7z with encryption. When I do so, there is an option "Encrypt the file list too" so that when I open the zip file, it asks me straight away for the password without showing the filenames (in Engrampa anyway).

If Engrampa can do it, there will be a way to do it on the command line.
 
1 members found this post helpful.
Old 09-18-2018, 07:08 PM   #5
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Can confirm that the following works in the way that you want:

Code:
7z a -mhe=on -pSECRET out.7z bbbb.jpg cccc.jpg

7z e out.7z
So, as michaelk correctly pointed out, it's just a case of choosing another archiving format, in this case 7-zip.
 
1 members found this post helpful.
  


Reply

Tags
zip



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How To Use Zip & 7zip To Encrypt/Decrypt and Password Protect Files/Folders in Linux LXer Syndicated Linux News 0 08-21-2017 12:23 PM
[SOLVED] Copy protect pdf files without password CVAlkan Linux - Software 5 04-07-2015 11:26 PM
Help!! how to password protect tar and zip files pnmanojshenoy Linux - Newbie 3 07-08-2008 01:18 AM
How do I password protect folders/files? shodekiagari Linux - Software 6 12-04-2004 12:16 PM
password protect zip files xlord Linux - Newbie 3 05-04-2004 12:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration