This article guide you on how to create, and set password for rar zip file on Ubuntu and Linux to help you protect important files, documents and data.
How to set password for rar zip file on Ubuntu and Linux
There are several ways for you to password-protect zip, rar files, etc. to protect important data.
1. Generate a zip file password on Ubuntu using command
Before you start you need to install zip and unzip using the following command.
sudo apt install zip unzip
To compress the file and create a password, open a terminal and move (cd) to the folder you want to zip and use the command:
zip -re filename.zip file
For example, below, show cd to the Download folder and compress the file pass-file.txt
cd ~/Downloads zip -re filename.zip pass-file.txt
Option -r is used to compress the file and option -e is to create a password for the file. If you want to compress all files in a folder, after the file name you just need to write an asterisk (*).
zip -re filename.zip *
2. Set password for zip and RAR files using Archive Manager
First, click on the menu and search and open Archive Manager
The file manager interface appears, drag and drop the file, select Create Archive and proceed with the setup.
- Filename: Set a name for the zip file.
- Other Option: set a password for the file
- Save: Save the zip file with your settings.
This way can be applied to Ubuntu 20.04 and above, with Ubuntu 16.04 and below, just right-click on the file you want to create zip, rar then select “Compress…” And you can set up the same password as with the Archive Manager.
Of course, you also need to install zip unzip, rar unrar
sudo apt install rar unrar sudo apt install zip unzip
3. Set password for RAR file on Ubuntu using command
Similar to the first way with zip, rar file also does the same, install it if not already.
sudo apt-get install rar unrar
To set a password for the RAR file, cd to the folder to be compressed and then type the following command to process the file compression.
rar a -p tenfile.rar file
Above are ways to help you set password for rar zip file on Ubuntu and Linux. If you have any questions, leave a comment below!