Hack 46. Password Protection of Zip files
by Ramesh
Pass the option –P to the zip command to assign a password to the zip file.
- # zip -P mysecurepwd var-log-protected.zip /var/log/*
The above option is good if you are using the command inside a shell-script for background jobs. However, when you are performing the compression interactively on the command-line, you don’t want the password to be visible in the history. So, use the option –e as shown below to assign the password.
- # zip -e var-log-protected.zip /var/log/*
- Enter password:
- Verify password:
- updating: var/log/acpid (deflated 81%)
- updating: var/log/anaconda.log (deflated 79%)
When you are uncompressing a password protected file, it will ask for the password as shown below.
- # unzip var-log-protected.zip
- Archive: var-log-protected.zip
- [var-log-protected.zip] var/log/acpid password:
当前内容版权归 Ramesh Natarajan 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Ramesh Natarajan .