E37 error at the server vim mode: No write since last change (add to override!)

Symptom:

Use vim to modify the file error, the system prompts as follows:

E37: No write since last change (add ! to override)

 

cause of issue:

File is read-only files can not be modified.

 

Solution:

Use the command: w forced to save in vim mode, type the following command!:

: W! (Mandatory written)

: Q (forced saving)!

Save and use vim command to check whether to save, if not saved, edited Repeat.

 

Or reported "Can not open file for writing" when linux save the file in the vi

E212: Can't open file for writing

Press ENTER or type command to continue

 

   The emergence of this error may be two reasons: First, lack of current user's privileges, and second, this file may be in use by another program or user. The cause of the error here is that the former, when the solution is to open the file using the vi command preceded by sudo to provide temporary administrator privileges by using the command "sudo vi grub.cfg" to open the Edit File. Seen in this light, sudo command is useful when we perform an operating system prompt, such as lack of information "operation not permitted" and other rights, we can add a lot of time in front of the sudo command to solve the problem of insufficient permissions

 

To resolve permission issues with the sudo command

sudo vim file 

  Using the above command, you can write to the file saved (you can use the command  : WQ )

 

 

Guess you like

Origin www.cnblogs.com/zmdComeOn/p/11810621.html