2

I'm writing a script for XFCE Spin Fedora 25 that configures the system and uses xfconf-query to modify configuration of the XFCE desktop enviroment.

This script needs to be executed with sudo because it has to modify the system and install packages. The problems comes from xfconf-query itself. It doesn't work when I launch the script with sudo, but it works when I use it as bash script.sh. I decided to pass $USER as an argument to the script and try to use the xfconf-query commands with su <user> -c "commands here", but it doesn't work.

Now I have to use 2 separated scripts, one for general tasks and the other for all the xfconf-query commands.

Edit: when I type sudo xfconf-query -c xsettings -p /Net/ThemeName -s "Greybird" in the terminal it works, but when I use the same command with sudo it doesn't work. That command may need to be used by the user demanding the change but it's weird that with su <user> -c "command here" launched in a bash interpreter with privileges it doesn't work.

  • 1
    Do you have '#!/bin/bash' as the first line of your script? – Herb Wolfe Mar 26 '17 at 22:30
  • @HerbWolfe yes, I've edited my question and now you can have more context. The problem seems to be with the intrinsic behavior of the command xfconf-query. – Lupo Dharkael Mar 27 '17 at 1:05
1

Ok, I've found a solution in a forum. It doesn't work correctly with sudo but it works with gksudo! http://forum.xfce.org/viewtopic.php?id=10870

edit: I've found another way. I've post the solution in that post in the xfce forum.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.