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

  <info>
    <link type="guide" xref="index#gedit-advanced"/>
    <desc>Access files as an administrator.</desc>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Vincent Untz</mal:name>
      <mal:email>vuntz@gnome.org</mal:email>
      <mal:years>2006.</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Jonathan Ernst</mal:name>
      <mal:email>jonathan@ernstfamily.ch</mal:email>
      <mal:years>2006.</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Philippe Lefevre</mal:name>
      <mal:email>ph.l@libertysurf.fr</mal:email>
      <mal:years>2006.</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Christophe Bliard</mal:name>
      <mal:email>christophe.bliard@trux.info</mal:email>
      <mal:years>2006.</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Claude Paroz</mal:name>
      <mal:email>claude@2xlibre.net</mal:email>
      <mal:years>2007-2011.</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Bruno Brouard</mal:name>
      <mal:email>annoa.b@gmail.com</mal:email>
      <mal:years>2011.</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Luc Pionchon</mal:name>
      <mal:email>pionchon.luc@gmail.com</mal:email>
      <mal:years>2011.</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Alain Lojewski</mal:name>
      <mal:email>allomervan@gmail.com</mal:email>
      <mal:years>2011-2014.</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Alexandre Franke</mal:name>
      <mal:email>alexandre.franke@gmail.com</mal:email>
      <mal:years>2013.</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Julien Hardelin</mal:name>
      <mal:email>jhardlin@orange.fr</mal:email>
      <mal:years>2013.</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Guillaume Bernard</mal:name>
      <mal:email>associations@guillaume-bernard.fr</mal:email>
      <mal:years>2018</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Charles Monzat</mal:name>
      <mal:email>charles.monzat@free.fr</mal:email>
      <mal:years>2020</mal:years>
    </mal: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>
