Open a text file as root by just using the right click menu

i found in thunar there r cutom actions for making item in contextmenu, like open as root for folder, and i found edit as root for text files, but it doesn't worked with me:

### Edit file as root

* Name: **Edit as root**

* Command: `gksu put-your-favourite-text-editor-here %f`

* File pattern: *

* Appears if selection contains: Text files

**Note:** You'll need to replace put-your-favourite-text-editor-here with your favourite text editor (e.g. mousepad or geany). Also, see previous note about `gksu`.

image
but that not worked , just pop up message and when type password, no text open

Currently you have three topics open on this issue.
@jgordon last posted a usable workaround here;

The app gksu was deprecated due to a security vulnerability that the developers could not readily fix.
The app pkexec somewhat replaces it, but not fully. Pkexec does not work with all applications.
It should work on thunar:

pkexec thunar %f

1 Like

it's required to create new file /usr/share/polkit-1/actions/org.freedesktop.policykit.gedit.policy for example and add that in it

<?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.gedit">
    <description>Run gedit program</description>
    <message>Authentication is required to run the gedit</message>
    <icon_name>accessories-text-editor</icon_name>
    <defaults>
        <allow_any>auth_admin</allow_any>
        <allow_inactive>auth_admin</allow_inactive>
        <allow_active>auth_admin</allow_active>
    </defaults>
    <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/gedit</annotate>
    <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
    </action>
</policyconfig>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.