Why is it difficult to use vim's forced writing?

Source: Internet
Author: User

Why is it difficult to use vim's forced writing?

A beginner in Linux usually installs a graphical interface. When a graphical interface is installed, a common user is created, and this common user is usually used to log on to the system (note: this is also recommended in the book. root Super Users are very dangerous and can easily delete important configuration files .)

The most common scenario is that a common user wants to edit a file in the/etc directory, but the files in this directory are generally read-only for common users. Take the/etc/inittab file as an example. The user permissions are as follows:

-Rw-r --. 1 root 884 Feb 19 inittab

Other users only have read-only permission and no write permission.

After editing the/etc/inittab file, a common user cannot write the/etc/inittab file because he does not have the write permission and directly enters the command w, which is understandable.

Isn't there a forced write? input: w !, Why not? Vim !!!

If vim can be successfully written, the level of this security vulnerability can also be different from that of opensslCardiac hemorrhage.

Vim's so-called forced write is the ability of the user to change this file to a write permission, but the permissions currently set are only read-only.

For another example,

-R --. 1 syy 16 Apr 15 :20 mytest.txt

For the user, the mytest.txt file has the read permission. After using vim to edit the file, you cannot directly use w to write the file, but you can use w! To force write.

For example, if mytest.txt is owned by a syyuser, I can change the mytest.txt file to a write permission.

[Syy @ syy ~] $ Chmod u + w mytest.txt [syy @ syy ~] $ Ll mytest.txt-rw-r --. 1 syy 16 Apr 15 :20 mytest.txt

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.