Linux operation Tip: "Can ' t open file for writing" or "Operation not permitted" workaround

Source: Internet
Author: User

The use of the VI command on Linux to modify a file content, found unable to save, each time after the use of ": q!" command can exit normally but use ": wq!" command to save the file and exit when the message appears:

E212:can ' t open file for writing press ENTER or type command to continue

There can be two reasons for this error:
1. Insufficient permissions for the current user
2. This file may be in use by another program or user.
The general cause of the error is the former, the solution is to open the file with the VI command, preceded by sudo to provide temporary administrator privileges, such as the use of the command "sudo VI hosts" to open the editing file.
As a result, the sudo command is useful, and when we perform some kind of operating system hint such as "Operation not permitted" and other insufficient rights, we can often add sudo to the command to resolve the problem of insufficient permissions. For example, when we download a file from a Linux server or upload a file may prompt this, there is a direct upload can not be successful but nothing prompt, then you should think about the account is not enough permissions, add a sudo try.

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: 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.