Thursday, May 16, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 9106  / 2 Years ago, thu, november 17, 2022, 7:31:10

A few hours earlier I bought a beaglebone and now I am trying to add nameserver 8.8.8.8 to /etc/resolv.conf. However when I open it with vim and try to add my nameserver, it gives me E21: cannot make changes, 'modifiable' is off. I changed permissions via chmod. chmod u+rx /etc/resolv.conf But nothing changed. I am still unable to write into resolv.conf file. What should I do?


More From » vim

 Answers
6

From vim documentation:



If you make changes to a file and forgot that it was read-only, you can
still write it. Add the ! to the write command to force writing.



If you really want to forbid making changes in a file, do this:



vim -M file


Now every attempt to change the text will fail. The help files are like this,
for example. If you try to make a change you get this error message:



E21: Cannot make changes, 'modifiable' is off 


You could use the -M argument to setup Vim to work in a viewer mode. This is
only voluntary though, since these commands will remove the protection:



:set modifiable
:set write

[#37686] Saturday, November 19, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
itutejagua

Total Points: 89
Total Questions: 124
Total Answers: 113

Location: British Indian Ocean Territory
Member since Sun, Feb 13, 2022
2 Years ago
;