Linux uses VI to encrypt and decrypt files __linux

Source: Internet
Author: User
Tags decrypt
Today, in the Linux editing file/etc/rc.local, you should enter after editing: X saved, the result accidentally entered: X (uppercase X), and then prompted two times to enter the password, I followed the prompts to operate successfully.
Because it was the first time I ran into it, I didn't know it was a file encryption.
Later restart the machine, found oracle10g database and did not boot from the start, and then go to see rc.local, found with more command to see is garbled, with VI input correct password after the normal display.
I don't quite understand what's going on, how can I decrypt it? So I searched the internet for some information and summed it up:

Linux uses VI to encrypt and decrypt files
First, the use of VI encryption:
Advantages: After encryption, if you do not know the password, you can not see the plaintext, including root users can not see;
Disadvantage: It is obvious to let others know the encryption, easy to let others to destroy the encrypted files, including content destruction and deletion;

VI Editor believe that everyone is very familiar with it, VI has a command is to file encryption, for example:
1 first in the root directory/root/under the establishment of an experimental file text.txt:
[Root@www ~]# VI text.txt
2 into the edit mode, enter the content after the ESC, and then enter: X (note is the capital X), carriage return;
3 then the system prompts you to enter the password, 2 times, as follows:
Enter Password: *******
Please enter again: *******
4 after the Save to exit, now this file has been encrypted;
5 with cat or more to view the contents of the file, displayed as garbled, edit this file with VI, will prompt for the password, if the password entered incorrectly, will also appear as garbled.
Note: After encrypting the file, never forget your password.
Second, decrypt the file with VI encryption (if you know the encrypted password):
1 with vi Open file such as Text.txt, to enter the correct password, and then edit, the password set to NULL, the method is to enter the following command:
: Set key=
Then direct return, save the file, the file has been decrypted.
2) or This is OK:
Use the ": X" command after the file is opened correctly, and then give an empty password.
The two methods actually have the same effect.

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.