Setting dconf values as admin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting dconf values as admin

Josef Wolf
Hello everybody,

According to the instrunctions on

  https://wiki.gnome.org/action/show/Projects/dconf/SystemAdministrators?action=show&redirect=dconf%2FSystemAdministrators

I have created a file

  $ sudo cat /etc/dconf/db/ibus.d/01-cfsvn-global-defaults
  [org/gnome/desktop/background]
  picture-uri='file:///etc/lightdm/my-wallpaper.jpg'


But this don't seem to have any effect. I have run "dconf update" as root and
as ordinary user. Still no effect.

Any ideas?

--
Josef Wolf
[hidden email]

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Setting dconf values as admin

Ralf Mardorf-2
On Wed, 25 Oct 2017 13:26:26 +0200, Josef Wolf wrote:
>  https://wiki.gnome.org/action/show/Projects/dconf/SystemAdministrators?action=show&redirect=dconf%2FSystemAdministrators

Hi,

I didn't read the Wiki.

>I have created a file
>
>  $ sudo cat /etc/dconf/db/ibus.d/01-cfsvn-global-defaults
>  [org/gnome/desktop/background]
>  picture-uri='file:///etc/lightdm/my-wallpaper.jpg'
>
>
>But this don't seem to have any effect. I have run "dconf update" as
>root and as ordinary user. Still no effect.
>
>Any ideas?

I don't know if or how /etc/dconf works, resp. if or how dconf update works, but you should be able to change settings for another user by running

sudo -u user_name dbus-launch dconf load /org/gnome/desktop/background/ < /etc/dconf/db/ibus.d/01-cfsvn-global-defaults

or

cat /etc/dconf/db/ibus.d/01-cfsvn-global-defaults | sudo -u user_name dbus-launch dconf load /org/gnome/desktop/background/

resp. depending on the read permissions

sudo cat /etc/dconf/db/ibus.d/01-cfsvn-global-defaults | sudo -u user_name dbus-launch dconf load /org/gnome/desktop/background/

Regards,
Ralf


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Setting dconf values as admin

Ralf Mardorf-2


> On 25 Oct 2017, at 13:51, Ralf Mardorf <[hidden email]> wrote:
>
>> On Wed, 25 Oct 2017 13:26:26 +0200, Josef Wolf wrote:
>> https://wiki.gnome.org/action/show/Projects/dconf/SystemAdministrators?action=show&redirect=dconf%2FSystemAdministrators
>
> Hi,
>
> I didn't read the Wiki.
>
>> I have created a file
>>
>> $ sudo cat /etc/dconf/db/ibus.d/01-cfsvn-global-defaults
>> [org/gnome/desktop/background]
>> picture-uri='file:///etc/lightdm/my-wallpaper.jpg'
>>
>>
>> But this don't seem to have any effect. I have run "dconf update" as
>> root and as ordinary user. Still no effect.
>>
>> Any ideas?
>
> I don't know if or how /etc/dconf works, resp. if or how dconf update works, but you should be able to change settings for another user by running

So first become root by running

sudo -i

and then run the following ;)

> sudo -u user_name dbus-launch dconf load /org/gnome/desktop/background/ < /etc/dconf/db/ibus.d/01-cfsvn-global-defaults
>
> or
>
> cat /etc/dconf/db/ibus.d/01-cfsvn-global-defaults | sudo -u user_name dbus-launch dconf load /org/gnome/desktop/background/
>
> resp. depending on the read permissions
>
> sudo cat /etc/dconf/db/ibus.d/01-cfsvn-global-defaults | sudo -u user_name dbus-launch dconf load /org/gnome/desktop/background/

FWIW you could run it for all users by using a loop


user_name=$(getnet passwd $i | cut -d: -f1)

where i are numbers from 1000 to n.

In the above examples replace user_name with the variable $user_name .


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Setting dconf values as admin

Ralf Mardorf-2
On Wed, 25 Oct 2017 14:07:25 +0200, Ralf Mardorf wrote:
>user_name=$(getnet passwd $i | cut -d: -f1)
             ^^^^^^
             getent

Oops, a typo.


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Setting dconf values as admin

Josef Wolf
In reply to this post by Ralf Mardorf-2
Hello,

On Wed, Oct 25, 2017 at 01:51:38PM +0200, Ralf Mardorf wrote:
> On Wed, 25 Oct 2017 13:26:26 +0200, Josef Wolf wrote:
> >  https://wiki.gnome.org/action/show/Projects/dconf/SystemAdministrators?action=show&redirect=dconf%2FSystemAdministrators

I keep this link as a reference

> >  $ sudo cat /etc/dconf/db/ibus.d/01-cfsvn-global-defaults
> >  [org/gnome/desktop/background]
> >  picture-uri='file:///etc/lightdm/my-wallpaper.jpg'
> >
> >But this don't seem to have any effect. I have run "dconf update" as
> >root and as ordinary user. Still no effect.

This was my original attempt

> sudo -u user_name dbus-launch dconf load /org/gnome/desktop/background/ < /etc/dconf/db/ibus.d/01-cfsvn-global-defaults
>
> or
>
> cat /etc/dconf/db/ibus.d/01-cfsvn-global-defaults | sudo -u user_name dbus-launch dconf load /org/gnome/desktop/background/
>
> resp. depending on the read permissions
>
> sudo cat /etc/dconf/db/ibus.d/01-cfsvn-global-defaults | sudo -u user_name dbus-launch dconf load /org/gnome/desktop/background/

All of those methods have the same problem:

If the user already has a dbus session runnning, a new dbus connection will be
started. Write operations on this new dbus session will go to /dev/null.

Thus, what I am looking for is:
- if the user already has a dbus session running, connect to this already
  existing dbus session
- if there is no dbus session for this user, create a new one

What would be the clean way to do this?

--
Josef Wolf
[hidden email]

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Setting dconf values as admin

Ralf Mardorf-2
On Wed, 25 Oct 2017 22:28:09 +0200, Josef Wolf wrote:
>If the user already has a dbus session runnning, a new dbus connection
>will be started. Write operations on this new dbus session will go
>to /dev/null.

It worked for me at least for other dconf settings when running a Tails
3.1 live DVD. I experienced another issue that is related to
gnome-terminal profiles, off-topic here, since it's not related to a
dbus issue. OTOH running a user 1000 session I opened a terminal, run a
script under root privileges, that runs

sudo -u user_1000 dbus-launch dconf load /org/foo/ < bar

Perhaps dbus-launch does the trick, if a script runs in a user's session
under root privileges and the script does change dconf for this user
session and maybe it doesn't work to change settings for another user
running a session.

IMO dconf is annoying crap, it gains absolutely nothing, but makes
configuring a PITA. It's already bizarr that the path for dconf does
use "/" and the path for gsettings does use "." as separator.

Regards,
Ralf


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Setting dconf values as admin

Josef Wolf
On Wed, Oct 25, 2017 at 10:54:55PM +0200, Ralf Mardorf wrote:

> On Wed, 25 Oct 2017 22:28:09 +0200, Josef Wolf wrote:
> >If the user already has a dbus session runnning, a new dbus connection
> >will be started. Write operations on this new dbus session will go
> >to /dev/null.
>
> It worked for me at least for other dconf settings when running a Tails
> 3.1 live DVD. I experienced another issue that is related to
> gnome-terminal profiles, off-topic here, since it's not related to a
> dbus issue. OTOH running a user 1000 session I opened a terminal, run a
> script under root privileges, that runs
>
> sudo -u user_1000 dbus-launch dconf load /org/foo/ < bar

This sudo session was running as a child of the desktop session and therefore
inherited the dbus session from the desktop.

My use case is different: I have a configuration tool which is (periodically)
started from cron. Therefore, there's no dbus session to inherit. And there's
no way to know in advance whether the user will be logged in at the time the
script is executed.

> Perhaps dbus-launch does the trick, if a script runs in a user's session
> under root privileges and the script does change dconf for this user
> session and maybe it doesn't work to change settings for another user
> running a session.

dbus-launch solves only half of the problem: it will create a session. This
works if the user is not logged in. But if the user is logged in, it will
create a second session, and all write operations will go into /dev/null.

> IMO dconf is annoying crap, it gains absolutely nothing, but makes
> configuring a PITA.

Yeah. dconf might be a good solution for interactive configurations on the
desktop. But configuring automatically via scripts was much easier with plain
old style config files.

What's more: with every release, the config methodology and the names of the
keys and values get new arbitrary names. This is really annoying for automatic
configuration :-(((

--
Josef Wolf
[hidden email]

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Setting dconf values as admin

Oliver Grawert
In reply to this post by Josef Wolf
hi,
Am Mittwoch, den 25.10.2017, 13:26 +0200 schrieb Josef Wolf:

> Hello everybody,
>
> According to the instrunctions on 
>
>   https://wiki.gnome.org/action/show/Projects/dconf/SystemAdministrat
> ors?action=show&redirect=dconf%2FSystemAdministrators
>
> I have created a file
>
>   $ sudo cat /etc/dconf/db/ibus.d/01-cfsvn-global-defaults
>   [org/gnome/desktop/background]
>   picture-uri='file:///etc/lightdm/my-wallpaper.jpg'
>
>
> But this don't seem to have any effect. I have run "dconf update" as
> root and
> as ordinary user. Still no effect.
>
did you read:

man 7 dconf

?

when using dconf it wants the $DCONF_PROFILE variable set (at least if
you want to set a global setting ... otherwise use the gsettings
command from within yur running session, which i'd actually recommend
...)

since you seem to be german:

https://wiki.ubuntuusers.de/GNOME_Konfiguration/dconf/
 has detailed info ....

ciao
        oli
--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

[SOLVED and additional question] Re: Setting dconf values as admin (use gsettings instead)

Josef Wolf
In reply to this post by Josef Wolf
On Wed, Oct 25, 2017 at 01:26:26PM +0200, Josef Wolf wrote:
> According to the instrunctions on
>   https://wiki.gnome.org/action/show/Projects/dconf/SystemAdministrators?action=show&redirect=dconf%2FSystemAdministrators

So here's my solution:

First of all, dconf is low-level and is not meant to be messed by
applications. The way to go is glib and gsettings. Maybe this information
should be written somewhere at a prominent place.

So I go and create a file like this:

   $ cat /usr/share/glib-2.0/schemas/50-cfsvn-users.gschema.override
   [org.gnome.desktop.background]
   picture-uri='file:///etc/lightdm/my-wallpaper.jpg'
   
   [org.gnome.nautilus.list-view]
   use-tree-view='true'
   
   [com.canonical.unity-greeter]
   draw-grid='false'
   play-ready-sound='false'
   logo='/usr/share/unity-greeter/kde_badge.png'
   background='/etc/lightdm/my-wallpaper.jpg'
   draw-user-backgrounds='false'

Then, I call glib-compile-schemas like this:

  $ sudo glib-compile-schemas /usr/share/glib-2.0/schemas

This works fine so far. Since it won't fiddle with the user files, it doesn't
matter whether the user is logged in or not.


There's a drawback, though:

I'd rather not pollute system directories like /usr/share. I'd prefer to put
my files to /usr/local/share/glib-2.0/schemas which is also listed in
XDG_DATA_DIRS. But glib-compile-schemas won't accept that. It will refuse to
do anything if there are ONLY override files without any xml files.

So, any hints on that?

--
Josef Wolf
[hidden email]

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: [SOLVED and additional question] Re: Setting dconf values as admin (use gsettings instead)

Josef Wolf
On Thu, Oct 26, 2017 at 02:58:29PM +0200, Josef Wolf wrote:
>
> I'd rather not pollute system directories like /usr/share. I'd prefer to put
> my files to /usr/local/share/glib-2.0/schemas which is also listed in
> XDG_DATA_DIRS. But glib-compile-schemas won't accept that. It will refuse to
> do anything if there are ONLY override files without any xml files.
>
> So, any hints on that?

No ideas on this one?

--
Josef Wolf
[hidden email]

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users