How To Password Protect Text Files Using Vim Editor In Linux

Tolkem

Well-Known Member
Joined
Jan 6, 2019
Messages
1,383
Reaction score
1,127
Credits
9,937


Robert123

New Member
Joined
May 9, 2022
Messages
1
Reaction score
0
Credits
5
How To Password Protect Text Files Using Vim Editor in Linux

File encryption is a way of encoding files, including the sensitive data they contain, in order to send them securely. The encoding prevents unauthorized access and tampering by malicious actors. It keeps a file from being read by anyone except the person or people for whom it was intended.​

Encryption generally takes place through the use of keys.

Method:​

To encrypt an existing file, open the file with vim and press “ESC” key to enter into the command mode, then type command :X to get a prompt to enter the key. Type your key twice and press enter. That's it, the file is protected now.

View attachment 12498

Encryption key: Here, we are providing the key for encrypting the file.


View attachment 12501

View attachment 12502


If a third person tries to access the encrypted file using a wrong key then the file will be corrupted.

View attachment 12500

So, hence a valid encryption key is required so that the data is protected.
Thanks it's help me
 

SlowCoder

Gold Member
Gold Supporter
Joined
May 2, 2022
Messages
265
Reaction score
200
Credits
2,168
This should be a tutorial or tip.
I've never been a vi/m user. But if the right circumstance were to present itself, this would be a game-changer.
 

tonyalbers

New Member
Joined
Jan 28, 2022
Messages
8
Reaction score
5
Credits
56
Nice tip, just remember to:

[ESC]
:setlocal cm=blowfish2 [ENTER]

The default encryption is worthless.

/tony
 

Old Tom Bombadil

Active Member
Joined
Jul 29, 2020
Messages
90
Reaction score
109
Credits
832
I have not specified cryptmethod, so it's using defaults (Fedora 35). I create a file with -x and save the file. On opening the file again, providing passphrase, it shows blowfish2 with the file name, number of lines, and file size. Not sure why yours would behave differently.

VIM version 8.2.4845
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Top