Running gsettings as root

Oliver Grawert ogra at ubuntu.com
Wed Aug 17 12:37:50 UTC 2016


hi,
On Mi, 2016-08-17 at 11:21 +0200, Josef Wolf wrote:
> Hello,
> 
> I want to do lots of configuration settings as root in the background
> 
> I know, I can do this with
> 
> 
>    sudo -u $USER dbus-launch --exit-with-session gsettings set [ ....
> ]
> 
> 
> This works fine while the user is NOT logged in.
> 
> But it won't work if the user IS logged in.
> 
> 
have a look at the dconf command (dconf-cli package), IIRC dbus will
check if there is a gsettings-daemon running and block if there is one
(to prevent concurrent access to the same key) ... 

dconf can modify the db directly without involving the daemon.

example:
sudo -u $USER "dconf write /org/gnome/gnome-session/auto-save-session
true"

ciao
	oli

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20160817/fae6aef9/attachment.sig>


More information about the ubuntu-users mailing list