How To Set Password On A RAR Archive In Linux?

How To Set Password On A RAR Archive In Linux?

 
 

Files inside a RAR archive can have important data. So you may want to protect it from the unusual access. In Linux, the rar command provides a feature to set the password on rar archives. I already discussed to create a rar archive in Linux in a post. In this article, we will show you how to set a password in a RAR archive.

What are RAR archives?

Like other archives, a RAR file is a data container that stores one or several files in compressed form. RAR is a proprietary file format which is developed by Eugene Roshal. It is a native file format for the WinRAR archiver. RAR file uses .rar file extension. WinRAR application is not available for Linux we can use the rar program to create, extract or set the password in a RAR file.

Creating RAR archives

I already discussed it in a previous article but for the sake of completeness of this article, We will also create a rar file here. I have a directory named sample which contains some files inside it. To create sample.rar file from sample directory we will use the following command in the terminal –

rar a sample.tar sample

The output of this command will be something like given in the below image –

Now if it shows that the rar program is not installed in your system then first use the following command to install it and then again run the above command –

To install rar on Debian/Ubuntu/LinuxMint use –

sudo apt install rar

Or if you are using an rpm-based distribution then use

sudo yum install rar

To install it in Fedora use –

sudo dnf install rar

Set the password on a RAR archive

This is a very useful feature of the rar tool in Linux. It allows us to set a password on an archive file. Use the options a and -p with the rar command to create a password protected rar file. Now execute the following command in your terminal –

rar a -p sample.rar sample

This will prompt you to enter the password, enter it, It will ask to enter it again. Now once you press the enter the password will be set on that file.

Conclusion

There are a lot of options available that you can use with the rar command. You can see the manual page of the rar for more details. Now if you want to say something on this topic, Write your thoughts in the comments below.

Previous How To List The All Enabled Repositories In Linux?
Next How To Open and Extract RAR Files In Linux?

About author

You might also like

Linux Topics 0 Comments

File Ownership And Permissions In Linux/Unix

Linux and Unix are multi-user operating systems that means different users can access the operating system at a time and can use system resources simultaneously. So the files created by

Uncategorized 0 Comments

Concepts Of Standard I/O, Pipe And Filters In Linux/Unix

Contents1 Standard streams1.1 Input redirection – 1.2 Output redirection – 1.3 Append the output to an existing file-2 Pipe And Filters2.1 grep command-2.2 sort command-2.3 awk command- Standard streams In

Uncategorized 0 Comments

How To Install Or Remove A Package With Synaptic Package Manager In Ubuntu/Linux Mint?

Synaptic is a GTK-based GUI program. It is used as a frontend for the APT package manager. Generally, it is used for debian based Linux distributions but can be also

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply