How to ZIP all files and folders in a folder with a password?

Cort Ammon

Member
Registered
Joined
Jul 8, 2016
Messages
48
Points
8
My website is putting in public_html and I want ZIP all files and folders in this folder with a password? file format should be .zip and it needs a password to protect file. When I download it to Windows, I need to use password to open it. How can I do this?

Normally I am using this code zip -r filename.zip * .htaccess but I need to add password while creating zip file. can anyone help?
 

Pusya

Member
Registered
Joined
Nov 9, 2018
Messages
18
Points
3
That's easy.
You just zip them and set up a password during the "zip initiation" process. :D
 

Chris Worner

Well-known member
Registered
Joined
Apr 15, 2016
Messages
612
Points
28
That's easy.
You just zip them and set up a password during the "zip initiation" process. :D
This way is easy if you are using Windows and having a zip program to help you compress your files. It will be not easy if you are using Linux.

I got this from them
The command goes something like,
zip --encrypt foo.zip foo.txt which asks for password on terminal,
Enter password:
Verify password:
updating: foo.txt (stored 0%)
So when we need to open a zip file or extract this foo.zip from SSH, how to open/extract it with a password?
 

VirtuBox

Well-known member
Registered
Joined
May 3, 2016
Messages
1,622
Points
83
My website is putting in public_html and I want ZIP all files and folders in this folder with a password? file format should be .zip and it needs a password to protect file. When I download it to Windows, I need to use password to open it. How can I do this?

Normally I am using this code zip -r filename.zip * .htaccess but I need to add password while creating zip file. can anyone help?
Hello,
if you usually use :
Bash:
zip -r filename.zip * .htaccess
You just need to add "-P yourpassword" to your command :

Bash:
zip -r filename.zip * .htaccess  -P yourpassword
 

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top