0

I want to run a GUI application as another user (say other-guy). Whenever I want to do so, I run

xhost si:localuser:other-guy

The changes only persist until a reboot. How do I make this permission permanent, so that I don't have to run this command ever again?

For reference, I run KDE with SDDM as the display manager.

1 Answer 1

1

KDE executes scripts from directory ~/.kde/Autostart/ when you login automatically.

So one of solutions would be to create a file there, change permissions of the file to executable and put the needed code inside:

echo -e '#!/bin/sh\n/usr/bin/xhost si:localuser:other-guy\n' > ~/.kde/Autostart/xhost.sh
chmod 700 ~/.kde/Autostart/xhost.sh

So ~/.kde/Autostart/xhost.sh looks like this:

#!/bin/sh
/usr/bin/xhost si:localuser:other-guy

and is executed right after you log into KDE automatically.

2
  • For some reason, my KDE Autostart directory was ~/.config/autostart. Anyways, I put the script in there. I'll accept your answer after I reboot and test if it worked. Thanks :) Dec 24, 2019 at 6:48
  • I had to move the script to ~/.config/autostart-scripts and then it showed up under Startup Applications in KDE Settings. That perfectly worked. Thanks! Dec 24, 2019 at 18:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .