<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" type="topic" id="gedit-admin-privileges" lang="en_GB">

  <info>
    <link type="guide" xref="index#gedit-advanced"/>
    <desc>Access files as an administrator.</desc>
  <credit type="translator copyright"><name>Zander Brown</name><email>zbrown@gnome.org</email><years>2020</years></credit></info>

  <title>Edit a file with admin privileges</title>

  <note style="warning"><p>
    Editing files with administrator privileges is potentially dangerous, and
    may break your system in bad ways. Take great care.
  </p></note>

  <p>The instructions below assume that Linux is used.</p>

  <section>
    <title>If the file needs to be created</title>
    <p>
      First, if the file doesn't exist yet, it needs to be created beforehand.
    </p>
    <p>Open a terminal and execute a command like:</p>
    <code>sudo touch <var>/path_to_file</var></code>
    <p>Replace <var>/path_to_file</var> with the desired path.</p>
    <p>Example:</p>
    <code>sudo touch /root/gedit-test</code>
  </section>

  <section>
    <title>Open an existing file</title>
    <p>
      To edit an existing text file with <app>gedit</app> with admin privileges,
      open a terminal and execute a command like:
    </p>
    <code>gedit admin://<var>/path_to_file</var></code>
    <p>Replace <var>/path_to_file</var> with the desired path.</p>
    <p>To continue the example from the previous section:</p>
    <code>gedit admin:///root/gedit-test</code>

    <note>
      <p>
        You will need to successfully enter the administrator password in order
        to open the file.
      </p>
      <p>
        The <cmd>gedit</cmd> command needs to be executed as a normal,
        unprivileged user.
      </p>
    </note>
  </section>
</page>
