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