Vi/vim comes with encryption

Source: Internet
Author: User
Tags decrypt

Linux uses Vim/vi to encrypt and decrypt files
first, using VIM/VI encryption:
Advantages: After encryption, if you do not know the password, you can not see the plaintext, including the root user can not see;
Cons: Obviously let others know encryption, it is easy for others to destroy the encrypted files, including content destruction and deletion;

VI Editor believe that everyone is familiar with it, VI has a command is to encrypt the file, for example:
1) First create an experimental file under the root master directory/root/Text.txt:
[email protected] ~]# Vim/vi text.txt
2) Enter the edit mode, press ESC after entering the content, then enter: X (note is the uppercase X), enter;
3) Then the system prompts you to enter the password, 2 times, as follows:
Enter password: *******
Please enter again: *******
4) After saving the exit, now this file has been encrypted;
5) Use cat or more to view the contents of the file, displayed as garbled; re-edit this file with Vim/vi, will prompt for the password, if the password entered is incorrect, the same will be displayed as garbled!
Note: Do not forget the password after the file is encrypted!
second, decrypt the files encrypted with VI (provided that you know the encrypted password):
1) Open the file with Vim/vi, such as Text.txt, to enter the correct password, and then at the time of editing, set the password to empty, by entering the following command:
: Set key=
then directly enter, after saving the file, the file has been decrypted.
2) or This is OK:
after opening the file correctly with ": X" instruction, and then give a blank password can also. Save with "wq!" Save.
the two methods actually have the same effect.

Vi/vim comes with encryption

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.