Xed is not working with pkexec

I tried to add a custom action on Thunar based on the XFCE docs and specifically “Edit file as root”. I followed the tutorial and added this in the custom action: pkexec xed %f, but nothing showed up when I ran it. I tested it with another file using the same command on the terminal and here’s the output:

[rapta@endeavour ~]$ pkexec xed $HOME/Documents/scripts/test.sh

(xed:7072): Gtk-WARNING **: 18:14:41.143: cannot open display: 

Using sudo did work, but with sudo the notification doesn’t pop up and I can’t type my password, making it useless. I made another custom action with pkexec too (Open Thunar as root) which does work. Is it fixable?

Try mousepad.

pkexec mousepad works for me.

I get the same output as yours with pkexec xed.

For security reasons it is recommended to avoid running GUI stuff as root.
A better approach is to use e.g. nano or another non-GUI editor.

Another question is why do you need to edit the files at your $HOME as root?

2 Likes

xed admin:///etc/fstab

should work :slight_smile:
answer should be around here

https://forums.linuxmint.com/viewtopic.php?p=1850810&sid=d8a9365d19f10f67a75f563dc114fa9c#p1850810

As xed admin;//%f should do

2 Likes

It was an example

Doesn’t seem to work…

I replaced xed with mousepad and it works, thanks!

1 Like

sidenote the ; did the wrong

xed admin://%f

should work :slight_smile: no pkexec needed

Also please have a read here to know the security implications of running a GUI application as root:

https://wiki.archlinux.org/title/Running_GUI_applications_as_root

2 Likes

I am aware of the possible consequences, I use this function rarely and only when needed.

1 Like

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