https://www.2daygeek.com/zip-7zip-encrypt-decrypt-password-protect-files-folders-linux/
sudo apt-get install zip unzip
# zip --encrypt test.zip test.txt test1.txt
Enter password: ******
Verify password: *****
adding: test.txt (stored 0%)
adding: test1.txt (stored 0%)
Details :
zip : Command
–encrypt : To create encryption
test.zip : Zip file name
test.txt & test1.txt : These are files to be encrypted
To unzip encrypted zip file, just run the following command and input the password once.
# unzip test.zip
Archive: test.zip
[test.zip] test.txt password: ******
replace test.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
extracting: test.txt
replace test1.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
extracting: test1.txt
For floder encryption use -r option with zip command. In this example, we are going to create a encrypted zip file called test1.zip with test.txt, test1.txt file & test-dir folder.
# zip -r --encrypt test1.zip test.txt test1.txt test-dir/
Enter password: ******
Verify password: ******
adding: test.txt (stored 0%)
adding: test1.txt (stored 0%)
adding: test-dir/ (stored 0%)
adding: test-dir/test1.txt (stored 0%)
adding: test-dir/test.txt (stored 0%)
To unzip encrypted zip folder, just run the following command and input the password once.
# unzip test1.zip
Archive: test1.zip
[test1.zip] test.txt password: ******
replace test.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
extracting: test.txt
replace test1.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
extracting: test1.txt
replace test-dir/test1.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
extracting: test-dir/test1.txt
replace test-dir/test.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
extracting: test-dir/test.txt
网友评论