Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Debian version 9.3.

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
Russell136
Posts: 3
Joined: 2018-07-14 12:47

Debian version 9.3.

#1 Post by Russell136 »

Attention: Debian User Forum members:
There is a file on my Debian operating system ( Debian version 9.3 ) named "network-interface.conf." The path to this file is "/etc/init/network-interface.conf." After initially attempting to edit it in VIM, and then saving the changes using the command ":wq," I received the error message that the file was read only, but that I could use "!" to override the permissions on the file. After typing the command ":wq!," I received the same error message. I searched online, and learned that I could use the command "sudo chmod -R u+rw /etc/init/network-interface.conf" to change the permissions on the file to write permissions. After typing in that command, I again attempted to edit the file, but I received the same above-mentioned error message. Any suggestions regarding why I am not able to edit the file? Thank you .

Russell E. Willis

User avatar
cds60601
df -h | participant
df -h | participant
Posts: 706
Joined: 2017-11-25 05:58
Location: Florida
Has thanked: 129 times
Been thanked: 60 times

Re: Debian version 9.3.

#2 Post by cds60601 »

is sudo installed? Is your user added to sudoers?
Alternatively, you can su to root then mod as you see fit with the caveat there is danger to your system when su'ing if you don't know what you are doing.

Cheers
Chris
Supercalifragilisticexpialidocious

tynman
Posts: 131
Joined: 2016-05-03 19:48
Location: British Columbia, Canada
Been thanked: 1 time

Re: Debian version 9.3.

#3 Post by tynman »

Using the command

Code: Select all

chmod -R u+rw
is wrong. For three reasons.
  • 1. The "-R" option says to apply the permissions to all files in a directory and recursively through all subdirectories. In this case, you werre attempting to change permissions on a specific file, so the -R option should be removed.
    2. This gives the owner of the file read and write permission on the file. In this case, the owner of the file (safe assumption the owner is root) already has read and write permissions, so the command effectively does nothing.
    3. Most important: This is basically the wrong approach.
The approach I would suggest is:

Code: Select all

sudo vi /etc/init/network-interface.conf
This runs the vi/vim editor with root's permissions. After making the desired changes in vi/vim, the command ":wq" should now be able to save the updated file successfully.

Russell136
Posts: 3
Joined: 2018-07-14 12:47

Re: Debian version 9.3.

#4 Post by Russell136 »

Attention: Tynman:
Your suggestion solved the problem. After editing the file "/etc/init/network-interface.conf," the changes were saved to the file. Thank you.

Russell E. Willis

Johen Scott
Posts: 20
Joined: 2012-06-06 17:03

Re: Debian version 9.3.

#5 Post by Johen Scott »

This is interesting because typically I from a root terminal run

dbus-launch krusader

and right click and edit a file with root text editor.

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: Debian version 9.3.

#6 Post by debiman »

Johen Scott wrote:This is interesting because typically I from a root terminal run

dbus-launch krusader

and right click and edit a file with root text editor.
and once again, there's several reasons why you shouldn't start a graphical app as root.
it's not so bad with a file manager (i do it too sometimes), but it's not "interesting", and the convention is to use a command line editor.

debian even has the 'sudoedit' command.

Post Reply