
You get "permission denied" because of how Linux handles permission.Īnything in the $HOME folder belongs to the user, whereas almost anything else belongs to root. In case something goes wrong you can restore it from your backup in the home folder. Replace gedit with the editor of your choiceĪ new window opens and you can edit your config there. To be safe back it up using cp /etc/dhcp/nfig /$HOME/Īnd run gksu gedit /etc/dhcp/nfig

Some editor offer a command-line option to always start a new instance, even if one is currently running. Of course you can use any other editor that you like, e. Which is equivalent to VISUAL=gedit sudoedit /path/to/some-config-file.cfg You can use sudo -e or its alias sudoedit with your favourite (graphical!) text editor through the VISUAL environment variable 1: VISUAL=gedit sudo -e /path/to/some-config-file.cfg In Ubuntu 18.04, gksudo is not available in the official repositories. See Why don't gksu/gksudo or launching a graphical application with sudo work with Wayland? for details. In Ubuntu 17.10, Wayland is default instead of the traditional X server, and running graphical editors as root is difficult. You will have to install the gksu package (either from the Software Centre or via sudo apt-get install gksu) to get it. In Ubuntu 14.04 onwards, gksudo is not installed by default. In either case, you'll need to first provide your password when requested.

