You are not logged in.
Pages: 1
Hi, I have a script which runs as root (it cannot be changed), and need to set some xfconf options for specific user.
Consider this:
> xfconf-query -c thunar -p /last-view
ThunarIconView
I'm doing this:
> sudo -u user xfconf-query -c thunar -p /last-view -s ThunarCompactView
Unfortunately this doesn't change the option for that user:
> xfconf-query -c thunar -p /last-view
ThunarIconView
but
> sudo -u user xfconf-query -c thunar -p /last-view
ThunarCompactView
I don't unserstand where ThunarCompactView option value is stored, it's neither in .config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml nor in roots folder.
How to make it work?
Thanks
Offline
Hello and welcome.
It would appear that using the sudo command doesn't allow xfconf-query to properly connect to the xfconfd daemon to track the change. Most probably because sudo doesn't properly create access to your X environment. On my system, using your sudo command, I notice the entry change in my .config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml file (after about a 2-3 second delay), but not in the settings editor. On logout, xfconfd will write the settings it has in memory and overwrite the change made to the xml file.
However, using gksudo (or pkexec if you're trying to keep up with the Jonses) allows xfconf-query to connect to xfconfd and make the correct settings change:
gksudo -u toz "xfconf-query -c thunar -p /last-view -s ThunarCompactView"
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Sorry for posting in an old thread but this is the first result in the search of "xfconf-query sudo" and I wanted to share how did I solve this without gksudo (you can't dowload it in the Fedora's official repository).
I have a configuration script which requires sudo and uses xfconf-query.
I launch the script as:
sudo -E bash xfce.sh $USER
That way I can have the user and the enviroment variables.
The script is something like this:
#! /bin/bash
# install stuff here
# modify system here
su $1 -m -c 'xfconf-query -c xfce4-session -p /general/SaveOnExit -s false -n
xfconf-query -c xsettings -p /Net/ThemeName -s "Arc-Dark"
xfconf-query -c xsettings -p /Net/IconThemeName -s "Paper"
xfconf-query -c xsettings -p /Gtk/ButtonImages -s false
# more xfconf-query commands...
'
$1 contains the user and -m keeps intact the enviroment context.
You can have a look at my script here: https://github.com/lupoDharkael/FedoraX … er/xfce.sh
Your suggestions are welcome!
Last edited by Dharkael (2017-04-02 01:14:25)
Offline
without gksudo (you can't dowload it in the Fedora's official repository).
Doesn't pkexec serve substantially the same purpose in Fedora as gksudo does in (some) other distros? I do not use Fedora, so I have no personal knowledge. But I saw this:
https://ask.fedoraproject.org/en/question/7185/no-gksudo-so-just-su-or-sudo-then/
I've also seen the command (pkexec) mentioned numerous times in this forum, in regards to Fedora, when such things were being discussed.
Regards,
MDM
Offline
Pages: 1
[ Generated in 0.009 seconds, 7 queries executed - Memory usage: 535.42 KiB (Peak: 536.27 KiB) ]