Results 1 to 7 of 7

Thread: etc/network/interfaces file editing

  1. #1
    Join Date
    Jan 2013
    Beans
    18

    etc/network/interfaces file editing

    Hello,

    Basic question, but hoping someone can help me out. I have edited a file in /etc/network, which is interfaces. When I pull up the file using gedit or nano the changes are shown in the file that is displayed. However when I look at the file in unity, there are no changes showing, also when I try to change the file in unity, it says I do not have permissions (I already changed permissions to make changes). Are there two files in /etc/network that unity only shows one? Also, if changes are not permanent, why has the file changed in the past (before I made changes and it permanently affected my connection)? (there was a similar question to this but didn't answer my question).

  2. #2
    Join Date
    Feb 2008
    Location
    Land of fire and drought
    Beans
    Hidden!
    Distro
    Xubuntu

    Re: etc/network/interfaces file editing

    Right click the network icon and 'Edit Connections'. Does Network Manager reflect the changes?

    Importantly, did you make a backup copy of /etc/network/interfaces before tweaking it?

    Code:
    sudo cp /etc/network/interfaces /etc/network/interfaces.BAK
    ... or whatever else you want to call the copy. I sometimes append the date.

  3. #3
    squakie is offline I Ubuntu, Therefore, I Am
    Join Date
    Oct 2012
    Beans
    2,238
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: etc/network/interfaces file editing

    did you change the permissions on the /etc/network/interfaces file itself? What did you change them to? I believe that file needs to be owned by root. If you couldn't edit it so you changed permissions, change them back, then the next time you need to edit open a terminal window and use sudo gedit /etc/network/interfaces.

  4. #4
    Join Date
    Aug 2011
    Location
    52.5° N 6.4° E
    Beans
    6,808
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: etc/network/interfaces file editing

    Gedit has no problem editing a file for which you don't have write permission, but it won't be able to save the file (at least, not in the same location). Therefore, when you open it later you won't see the changes. And don't use "sudo gedit", use "gksudo gedit" instead. Sudo gedit may sometimes break your account by causing a few files in your home directory to be owned by root. GUI programs (programs opening a window of their own instead of living in the terminal) are best called with root privileges using gksudo.

    Whenever you don't have permissions to edit a file there's usually a good reason for it. Don't change the permission of system files for easier editing, but momentarily give yourself extra rights by using (gk)sudo.

  5. #5
    Join Date
    Nov 2007
    Location
    Wisconsin
    Beans
    1,139

    Re: etc/network/interfaces file editing

    Impavidus and squakie are right. /etc/network/interfaces is owned by root and not-user-editable for good reason.

    Changing that file can break how Network Manager connects your system to the world. Once that link is broken, it's more difficult to ask for help!

    Don't change a system file's permissions - that is a great way to break your system. Instead, use 'sudo' or 'gksudo' appropriately to edit as root.
    *Always* make a backup of the file before you edit it!
    And know how to restore from the backup when your edit fails.

    What are you trying to accomplish?
    There may be a simpler or safer way to do it.
    Last edited by Cheesehead; January 14th, 2013 at 12:39 AM.

  6. #6
    squakie is offline I Ubuntu, Therefore, I Am
    Join Date
    Oct 2012
    Beans
    2,238
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: etc/network/interfaces file editing

    Personally, I've never had a problem using gedit only. I remember a couple of years ago this discussion going around, and everyone could only come up with 1 example, and it wasn't changes in owndership, etc.. Instead, the root owned file being edited got gibberish. However, since this is still hanging around, go ahead and substitue gksudo in place of the sudo in my prior post. If you didn't already know, which I made the assumption you did, Impavidus is correct in that you can open a file to read, edit it all you want, but you can't save it to it's original path unless you have permissions. Also - we have no answer to my question on permissions, etc., yet.

    Dave
    Last edited by squakie; January 13th, 2013 at 11:56 PM.

  7. #7
    Join Date
    Jan 2013
    Beans
    18

    Re: etc/network/interfaces file editing

    OK, that answers a lot, as far as being able to save changes made. I'll make a note not to change files as far as permissions and using sudo vs gksudo. I think I originally deleted the file contents accidentally, and just put what was deleted back in. I think the permissions are the same too. So thanks.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •