6

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?

7

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

  • is there a way that change is so that i can open nearly anthing as root? – user194862 Oct 10 '13 at 11:54
  • 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 Oct 15 '14 at 0:12
  • 2
    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. – dez93_2000 Sep 19 '15 at 16:00
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.

0

a dirty little trick i use because on my distro the "%f" will never be blatantly passed on to pkexe

create a newfile with the following

#!/bin/sh
# Super User Execute
# Gives PkExec current environmental variables
#  and passes current parameters thru running shells to it.
#
# Use this file instead of gksu, gksudo, and, pkexe.
# /usr/bin/suxe

pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY $1 $2 $3 $4 $5 $6

save it as: ~/suxe (note: some distros DO NOT like the ~/ shorthand for home folder access. So, use your actual path in this situation) e.g /home/Johnny/Documents/suxe

then make it an executable file in /usr/bin

sudo cp ~/suxe /usr/bin/suxe

make it executable

cd /usr/bin
su chmod -x ./suxe

now in Thunars' custom action use:

Name: Open with admin access

Command: suxe thunar %f

File pattern: *

Appears if selection contains: Directories

hope this helps

0

I found with UbuntuStudio 18.04 suxe thunar method works without the %f but only after right clicking on a thunar file/folder pane. Doesn't work when right clicking on the desktop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy