How to password protect a zip file in Linux
If you need to password protect a zip file, look no farther than the zip command itself.
When you create a compressed zip file, chances are you might have sensitive information tucked inside that newly created archive. Should that be the case, the last thing you want to do is send that unprotected file to someone else, only to have it intercepted and the contents viewed.
To prevent that, you can use the built-in encrypt option with the zip command. It’s incredibly easy to use and should be one of your go-to options for zipping confidential files.
Let me show you how this is done. This will work, regardless of what distribution you are using, so long as you have zip installed.
SEE: Windows 10 security: A guide for business leaders (TechRepublic Premium)
How to password protect a file with zip
- Open a terminal window and create a practice file named testing. Create that file with the command touch testing.
- Zip and encrypt that file with the command zip–encrypt testing.zip testing.
- You will be prompted to type and verify a password for the newly-created (and encrypted) file.
- Once you’ve verified the encryption password, the zipped file is created and you can send it away.
Make sure you share the encryption password with whomever you send the file to (probably in a separate message or phone call), otherwise they won’t be able to decompress the file. In order to decompress the password-protected file, type the command unzip testing.zip.
You will be prompted for the encryption password. Once you successfully authenticate with the password, the file will be decompressed and is ready for viewing. And that’s all there is to it. Enjoy that added layer of protection.