password-protected files with zip in Linux

Quote from Root on 10/08/2022, 17:10The zip command can be used to create password protected zip files easily.
Here is a quick example:
we create a demo text file,named demo.txt
open the terminal and give the following command in the desired directory:zip -P *secret* compressed.zip demo
You can also type "--password" instead of the "-P".
Now you get a password-protected zip,named compressed.zip,
and the password is *secret* !
Of course you have to change the names to your needs....The above approach might be insecure since the password is visible
and the command is stored in the terminal history and can be retrieved.
Another option is the e option which prompts user to enter the password,
and you can not see it when you type it.
So now the command will be:
zip -e compressed.zip demoit will ask twice for the password,and you're done!
The zip command can be used to create password protected zip files easily.
Here is a quick example:
we create a demo text file,named demo.txt
open the terminal and give the following command in the desired directory:
zip -P *secret* compressed.zip demo
You can also type "--password" instead of the "-P".
Now you get a password-protected zip,named compressed.zip,
and the password is *secret* !
Of course you have to change the names to your needs....
The above approach might be insecure since the password is visible
and the command is stored in the terminal history and can be retrieved.
Another option is the e option which prompts user to enter the password,
and you can not see it when you type it.
So now the command will be:
zip -e compressed.zip demo
it will ask twice for the password,and you're done!