How to add custom action to open folder as root to Thunar?

34,822

Solution 1

It appears that this is indeed possible. Following are specific instructions to add such an action, taken from the Xfce site.

Opening a root Thunar
Name: Open a root Thunar here
Command: gksu thunar %f
File pattern: *
Appears if selection contains: Directories

Solution 2

As of 18.04 gksu is no longer even included in the default repositories. The recommended way to do this now is as follows:

Name: Open as admin
Command: thunar admin://%f
File pattern: *
Appears if selection contains: Directories

Weirdly though, Polkit will sometimes ask for the password twice when you first use this command. The elevated privileges seem to persist for several minutes so you won't be asked for the password again if you use the command several times in a short space of time.

Be aware that this isn't true root. You can modify or delete any files that would require root privileges via this method, however any files you create will just have your default user permissions.

Share:
34,822

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    Thunar has an option to add context menu custom actions to open Terminal, or to open folders and files in different applications.

    Could it be possible to add a menu custom action that would open Thunar itself as root?

  • Admin
    Admin over 10 years
    is there a way that change is so that i can open nearly anthing as root?
  • dez93_2000
    dez93_2000 over 9 years
    Would there be a reason why this doesn't work? Neither this nor "edit folder as root" do anything for me... nothing opens or happens...
  • dez93_2000
    dez93_2000 over 8 years
    to add: gksu not installed by default in xubuntu, sudo is. "sudo thunar %f" doesn't work, presumably because there's no way to pass the password to it. "thunar %f" works. You have to right-click a folder.
  • Quidam
    Quidam about 4 years
    Thank you! I read in a tuto to make "sudo..." instead of gksu for shortcut launchers, but it wasn't working. This one really works.
  • ThunderBird
    ThunderBird over 2 years
    This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review
  • Painkiller
    Painkiller over 2 years
    sorry @ThunderBird but i do not see any problem with my answer. If i did something wrong i can remove my answer