How to use nautilus as administrator (Gnome)

IMPORTANT NOTE: Does not work under Wayland

The way is by using pkexec. For this to be possible, we must create an execution policy, which will go in a file that we will locate in /usr/share/polkit-1/actions/. This file will be:

sudo nano /usr/share/polkit-1/actions/nautilus-root.policy

…and inside, copy:

    <?xml version="1.0" encoding="UTF-8"?>
     <!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
     <policyconfig>
       <action id="org.freedesktop.policykit.pkexec.run-nautilus">
         <description>Run Nautilus As Admin</description>
         <message>Authentication is required to run Nautilus As Admin</message>
         <defaults>
           <allow_any>no</allow_any>
           <allow_inactive>no</allow_inactive>
           <allow_active>auth_admin_keep</allow_active>
         </defaults>
         <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/nautilus</annotate>
         <annotate key="org.freedesktop.policykit.exec.allow_gui">TRUE</annotate>
       </action>
     </policyconfig>

Then, to run nautilus as root:

pkexec nautilus

The RebornOS Team