Linux operation hint: "Can ' t open file for writing" or "Operation not permitted" solution __linux

Source: Internet
Author: User

Use VI command on Linux to modify a file content, found that can not save, each time the use of ": q!" command can exit normally but use ": wq!" When the command saves the file and exits, a message appears:

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

There may be two reasons for this error:
1. Insufficient permissions for current user
2. This file may be in use by another program or user.
The common cause of error is the former, the solution is to open the file with the VI command, the front plus sudo to temporarily provide administrator rights, such as using the command "sudo VI hosts" to open the editing file.
In this sense, sudo commands are very useful, and when we perform some kind of operating system prompts such as "Operation not permitted" and other insufficient information, we can often in front of the command with sudo to solve the problem of insufficient permissions. For example, when we download a file from the Linux server or upload a file may be prompted this, but also willing to upload the direct unsuccessful but nothing prompted, then you should consider whether the account is not sufficient authority, 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.