How To Create A Password Protected Zip Archive In Linux?

How To Create A Password Protected Zip Archive In Linux?

 

This post was last updated on August 1st, 2020 at 12:25 pm

Files inside a zip archive can have important data. So you may want to protect it from the unusual access. In Linux, the zip command provides a feature to set the password on zip archives.

As I already discussed to create a zip archive in Linux. In this article, we will show you how to create a password-protected zip archive or set a password on the existing zip archive in Linux.

What are zip archives?

Zip is an archive file format that supports lossless data compression. Zipping and unzipping tools are available for various platforms. Windows and macOS and many other OS are providing built-in zip support. These files generally use .zip or .ZIP file extension. A zip tool allows you to specify the compression level from 1 to 9.

How to create a password-protected zip archive?

Suppose there is a directory named sample which contains some files and directories inside it. To create a zip archive of sample directory, use the following command in the terminal –

zip -r sample.zip sample

This command will create a zip file without any password. To create a password-protected zip archive, use the following command in the terminal-

zip -e -r sample.zip sample

How to set a password on an existing zip file?

Suppose there is a zip file named sample.zip that is not password protected. If you want to set a password on it then you could use the following command in your terminal –

zipcloak sample.zip

Once this command gets executed it will prompt you to enter the password for sample.zip file.

Extracting a password-protected zip file

It requires entering the password if you want to extract a password protected zip file. Use the following command and enter the password if prompted –

unzip sample.zip

Once you enter your password and press return key first it will create a directory with the name sample and then extract all the files and directories into this directory.

Conclusion

There are a lot of options available that you can use with the zip command. You can see the manual page of the zip for more details. Now if you want to say something on this topic then write your thoughts in the comments below.

Previous How To Extract A Zip File In Linux Using Terminal?
Next Understanding & Implementing Shape Detection using Hough Transform with OpenCV & Python
 

About author

You might also like

Linux Topics 0 Comments

How to Change the Hostname on a Linux Machine

This post was last updated on July 21st, 2020 at 01:24 pmSometimes you wanted to change the Hostname on a Linux machine like on your Ubuntu PC or a Fedora

Linux Topics 0 Comments

How To Mount And Unmount File Systems From The Linux Terminal?

This post was last updated on August 1st, 2020 at 12:13 pmIn Linux or Unix, mount command is used to mount(attach) a filesystem or storage device to a specific directory

Linux Topics 0 Comments

Understanding the Filesystem (Directory Layout) In Linux

This post was last updated on August 1st, 2020 at 12:58 pmEvery computer stores various types of data on a storage device such as hard disk, USB drive, etc. This

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply