Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that linux can't save the file

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

What if linux can't save the file? I believe there are many people do not understand, today, in order to let you know more about linux, so give you a summary of the following content, let's look down together.

What if linux vi cannot save the file?

Linux system vi edits read-only documents can not be saved solutions, use ordinary users to edit nginx.conf and other configuration files:

When saving, you will be prompted: if there is no Root Permission, you can use the following methods: add:

W! sudo tee%

In view of the error that vi cannot save the file, and the current user sudo permission may not be configured, prompt "xxx is not in the sudoers file. This incident will be reported." when using sudo, where XXX is the user name, that is, the user name does not have permission to use sudo, just modify the / etc/sudoers file. Here is how to modify it:

1. Enter superuser mode. That is, enter "su -", the system will let you enter the superuser password, enter the password to enter the superuser mode.

two。 To add write permissions to the file, enter the command "chmod Ubunw / etc/sudoers".

3. Edit the / etc/sudoers file. That is, enter the command "vim / etc/sudoers", type "I" to enter edit mode, find this line: "root ALL= (ALL) ALL" add "xxx ALL= (ALL) ALL" (where xxx is your user name) below, and then save (that is, press the Esc key first, and then type ": wq") to exit.

4. Revoke write permissions for the file. That is, enter the command "chmod Umurw / etc/sudoers".

Save again:

# check whether the save is successful: $grep sudo nginx.conf#test: W! sudo tee%

On the linux can not save the file how to share here, I hope that the above content can have a certain reference value for everyone, you can learn to apply. If you like this article, you might as well share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report