How To Set Password On A RAR Archive In Linux?
 

How To Set Password On A RAR Archive In Linux?

 

This post was last updated on August 1st, 2020 at 01:19 pm

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 on 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 then 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

How To 0 Comments

How to Capture Boot Time Error Messages

This post was last updated on June 3rd, 2020 at 04:28 pmOne of the easiest ways to capture boot time error messages (when no log file is present) is to

Linux Terminal 0 Comments

How To Manage KVM Virtual Machines From The Host Terminal?

This post was last updated on August 1st, 2020 at 12:24 pmVirtualization means creating virtual instances of resources such as storage devices, network resources, etc. Kernel-based virtual machine or KVM

How To 0 Comments

How To Run A Process In Background In Linux/Unix?

This post was last updated on August 1st, 2020 at 02:11 pmIn a Linux/Unix system, a process is an instance of a program that is running on a computer. When

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply