Add ‘Edit/Open as Root’ Context Menu Option in XFCE Desktop

This is a beginner’s guide shows how to add ‘open as root’ or ‘edit as root’ context menu (right-click menu) option to your files or folders in Linux with XFCE desktop.

In recent GNOME and MATE desktop, user can now double-click on files/folders outside of user home directory. It will pop-up authentication dialog, asking to type user password to get access. And, nautilus-admin and caja-admin packages are available for choice to add root access options in context menu.

GNOME authentication dialog.

The lightweight XFCE desktop does not has this feature at the moment. However, it’s easy to add custom right-click menu options by using file actions. And, here’s how to do the trick step by step.

Add ‘Open as Root’, ‘Edit as Root’ action in XFCE

The steps below should work in most Linux with XFCE and pkexec, including Ubuntu, Debian, Fedora, Arch and more

1. First, open “File Manager” from start menu and go to menu “Edit -> Configure custom actions …”.

2. In pop-up “Custom Actions” dialog, click on “+” icon to add a new action.

3. Then, do following steps in next window to add “Open as Root” option for folders:

  • Type name: “Open as Root” (or “Open as Admin” as you prefer)
  • Type description with whatever text as you want.
  • Set command to pkexec thunar %f, so to use thunar file manager to open selected item
  • Select an icon if you want.
  • Finally, select Directories under “Appearance Conditions” so the custom action only appear in right-click menu of a folder.

4. Re-do step 2 & 3 by replacing the name, and command to add “Edit as Root” option for files:

  • Type name: “Edit as Root” (or “Edit as Admin” as you prefer)
  • Type description with whatever text as you want.
  • Set command to pkexec mousepad %f, so to use mousepad text editor to open selected item
  • Select an icon if you want.
  • Finally, select Text files under “Appearance Conditions” so the custom action only appear in right-click menu of a file.

Finally, right-click on a folder and/or file which is NOT belong to your user, then you’ll see the new options to either edit or open as root.

By clicking on either option will pop-up the authentication dialog. After typing correct user password, it will open the file/folder with the program you set as root (super user) account.

That’s it. Enjoy!

Hi, I'm Merilyn Ne, a computer geek working on Ubuntu Linux for many years and would like to write useful tips for beginners. Forgive me for language mistakes. I'm not a native speaker of English.