Vim password manager

Vim can also be used to safely store information, by encrypting text files with different cryp methods. To see the cryp method that Vim is currently using, type:

:set cryptmethod?

We can see in our case it is zip, which is not actually a crypto method and does not offer much in terms of security. To see what different alternatives we have, we can type:

:h 'cryptmethod'
Vim password manager

A page describing the different encryption methods comes up. We can choose from zip, blowfish, and blowfish2.The most secure and recommended one is, of course, blowfish2. To change the encryption method, type:

:set cryptmethod=blowfish2

This can be also added to vimrc so that it becomes the default encryption. Now we can safely encrypt files using Vim.

A common scenario would be storing a passwords file.

Let's open up a new file named passwords.txt, add some dummy passwords inside, and save it. The next step is to encrypt the file with a password, and for this we type :X.

Vim will prompt you for a password twice. If you exit without saving the file, the encryption will not be applied. Now, encrypt it again, save, and exit the file.

When we reopen it, Vim will ask for the same password. If we get this wrong, Vim will show some random characters that come from the failed decryption. Only if we type the correct password will we get the actual file content:

Vim password manager

Saving encrypted files with Vim, combined with backing up the file in places like a private git repository or a private Dropbox folder, can be an effective way of storing your passwords:

Vim password manager

It also has the benefit that it's sort of a unique method of storing passwords, compared to using online services that are pretty standard and might get compromised. This can also be referred to as security throug h obscurity.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.10.137