How do I get permissions to edit system configuration files?

Which text editor are you using? If you are a root user and know the password, try (in a terminal) either:

  • sudoedit /etc/dhcp/dhcpd.config if you are using a terminal-based editor such as nano or are ssh'ing into a server.
  • gksudo <text editor here> /etc/dhcp/dhcpd.config if you are using a GUI-based editor such as gedit

In either case, you'll need to first provide your root password when requested.

In Ubuntu 14.04 onwards, gksudo is not installed by default. 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 17.10, Wayland is default instead of the traditional X server, and running graphical editors as root is difficult. See Why don't gksu/gksudo or launching a graphical application with sudo work with Wayland? for details.

In Ubuntu 18.04, gksudo is not available in the official repositories. Use sudo -H <text editor> instead, or the admin:// protocol:

gedit admin:///etc/dhcp/dhcpd.config

If you don't want to use a terminal, you can invoke a GUI program as root thus (this example is for Gedit):

  1. Hit Alt+F2 to bring up the Run dialog.
  2. Type gksudo followed by the executable name of your program (which might be different from the name displayed by the GUI). For example:

    gksudo gedit
    
  3. Hit Enter.

I can't think of a case where root would get permission denied.

In 12.04 you can do it like this: alt+f2 and enter gksudo in the box that appears like this:

F2 dialogue

You get a box like this and enter gedit and click ok:

Type gedit in Run dialogue

Click Open:

Open tab inside gedit

Just browse to the file:

open files dialogue

Done

Warning: There is a super-user/root for a reason. It's so that you don't accidentally put something bad or out of structure in something important by mistake. You should be exceedingly careful that whatever you edit as root is the correct file you mean to edit AND that your syntax is perfect. If other tools are available for editing, it's recommended to use those. For instance, use the visudo terminal command instead of manually editing /etc/sudoers.

Some files that could get messed up are easy to recover from. Others are relatively complicated or you have to use recovery console and a lot of command lines.

Yes the recovery console command line seems a little scarier than even this. Just be careful.