How to password protect a file Using VIM
To Password Protect A File Using VIM
Password protecting a file is very easy in Linux and this tutorial covers the method to password protect a file using Vim. It is so simple, we will show you how to secure a file at the time of its creation as well as after opening it for modification.
Password Protecting A File
Before you begin, you need to install the full version of Vim, and for that simply run the following command.
[root@linuxhelp ~]# yum install vim
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
.
Installed:
vim-enhanced.x86_64 2:7.4.160-2.el7
Complete!
Vim has a -x option which enables you to use encryption when creating files. Once you run the vim command below, you’ ll be prompted for a crypt key:
[root@linuxhelp ~]# vim -x file.txt
~
~
~
Enter encryption key: *******
Enter same key again: *******
If the crypto key matches after entering it for the second time, you can proceed to modify the file.
In case you enter a wrong password (or no key), you’ ll see some junk characters.
That’ s all! With this simple trick you can password protect a file via the Vim text editor in Linux.
Comments ( 0 )
No comments available