Debian version 9.3.

New to Debian (Or Linux in general)? Ask your questions here!

Debian version 9.3.

Postby Russell136 » 2018-07-14 13:11

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
Russell136
 
Posts: 3
Joined: 2018-07-14 12:47

Re: Debian version 9.3.

Postby cds60601 » 2018-07-14 13:25

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
Yeah, 220, 221. Whatever it takes.
User avatar
cds60601
 
Posts: 125
Joined: 2017-11-25 05:58

Re: Debian version 9.3.

Postby tynman » 2018-07-14 14:36

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.
tynman
 
Posts: 75
Joined: 2016-05-03 19:48
Location: British Columbia, Canada

Re: Debian version 9.3.

Postby Russell136 » 2018-07-14 18:15

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
Russell136
 
Posts: 3
Joined: 2018-07-14 12:47

Re: Debian version 9.3.

Postby Johen Scott » 2018-07-26 02:27

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.
Johen Scott
 
Posts: 11
Joined: 2012-06-06 17:03

Re: Debian version 9.3.

Postby debiman » 2018-07-31 12:24

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.
User avatar
debiman
 
Posts: 2605
Joined: 2013-03-12 07:18


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 7 guests

fashionable