Re: default setup for multiple users with gconftool-2



On Tue, Aug 17, 2004 at 02:37:07PM -0700 or thereabouts, Wayne Pinette wrote:
> First, my apologize if this has been asked a thousand times before, but
> Im new to the list and need an answer to the problem :-)

It has been asked, but there have been few answers. I did start
to write something up about it, but never finished. It was based
substantially on someone else's notes: if you have questions, I
shall probably not be able to answer them. 
 
> I have a new server which is actually giong to be a server for multiple
> people logging on via X-windows in an intranet environment.
> The box itself is pretty darn scookum so Im not too worried about load.
>  What I would like is that their gnome environment when they
> login has very few options.  ie,the panel has a shell terminal starter,
> emacs editor, mozilla launcher and a logout.  I can easily do this with 
> the gui for a single user but every new user needs this done, and there
> will be new users added and users deleted every 4 months.  Is there
> a way to setup the default panels?  I have looked at the web sites and
> other lists and can't seem to find a "proper" way to accomplish this.
> Running redhat linux AS 3.0 with gnome version 2.2.2

I'm appending an attachment which contains Alan's notes.

It was written in January this year, and I can't remember whether
it was written for Gnome 2.4 or Gnome 2.6. I am pretty sure that
gconftool-2 was around in Gnome 2.2, though, so you have a hope.
You probably need the whole thing to make sense of it: the stuff
you want starts down around ""gconftool-2 --dump /" will dump..."

Note that it won't affect Evolution or some other applications.

He also said something about it being possible to have a "revert
to default settings whenever someone logs in" facility with this. 

Telsa

Gnome Configuration

Many programs have individual configuration files, which can make
configuration management difficult. Gnome solves this by using GConf,
which keeps per user configuration data in one place, and in a form that
allows easy updating and modification.

The configuration options are sorted in a tree, much like the file system.
Thus for exampple

	/desktop/gnome/interface/font_name

is the current default font.

You can query these from the command line using gconftool-2 eg

	#!/bin/sh
	echo -n "The current font is :"
	gconftool-2 -g /desktop/gnome/interface/font_name

and you can dump the entire gconf tree with the command "gconftool-2 -R /"
if you want to see what it holds. When you try this you will find a large
number of strange items in /schema. These describe the types of variable
allowed and expected by the programs.

Setting a value in a script requires you know both the name of the
configuration variable and the type (typically 'int' for integer, 'string'
for text or 'bool' for boolean (yes/no) values, or 'pair' for name=value).

One common example where this is useful is preconfiguring the web proxy used
by gnome applications, ready for new users

	#!/bin/sh
	#Set up the proxy server
	#
	gconftool-2 -s /system/http_proxy/use_http_proxy -t bool true
	gconftool-2 -s /system/http_proxy/host -t string proxy.example.com
	gconftool-2 -s /system/http_proxy/port -t int 8080

If you want to know the types to use with a given key you can ask gconf.

	gconftool-2 --get-schema-name /system/http_proxy/host

will tell you the name of the schema (the definition of the types accepted
by this key). In this case /schemas/system/http_proxy/host

	gconftool-2 -g /schemas/system/http_proxy/host

Will display information about the key, including the type and help texts
that explain what it does.

	Type: string
	List Type: *invalid*
	Car Type: *invalid*
	Cdr Type: *invalid*
	Default Value:
	Owner: gnome-vfs
	Short Desc: HTTP proxy host name
	Long Desc: The machine name to proxy http through.


Gconf also allows backup and restore of configuration data. This can be 
valuable when playing with gconftool-2, and also for moving settings between
two systems.

"gconftool-2 --dump /" will dump the entire configuration tree into an XML
file that can later be restored. You can also dump subtrees, so if we wanted
to move the epiphany settings from one machine to another we would do

	gconftool-2 --dump /apps/epiphany >dump.xml

copy dump.xml to the other system, and on the other system
	
	# Make a backup
	gconftool-2 --dump / > backup.xml
	# Remove old epiphany configuration
	gconftool-2 --recursive-unset /apps/epiphany
	# Load the keys from the other system
	gconftool-2 --load dump.xml /apps/epiphany
	
The --recursive-unset can be quite useful in itself if used carefully, when
you want to revert an application back to default behaviour, perhaps because
of a problem or after over zealous experimentation. Be very very careful
to get the gconf path right, and make a backup first.

The dump and restore also allow the configuration of standardised
environments, and their enforcement at login time. If there is a user
account shared by many people which has a functional role - such as a guest
or a network management user, you can use gconftool-2 to restore a 
standardised look and feel for each new login.

Finally, although the detail would need a book by itself, people familiar
with XSLT can use the fact that gconftool-2 dumps are XML files to build
stylesheets that allow the deployment of customised versions of a default
configuration, or to edit the user configurations.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]