[clug] Local configuration on a non-homogeneous LAN

Brenton Ross rossb at fwi.net.au
Sat Jun 22 03:38:58 UTC 2019


On Sat, 2019-06-22 at 08:27 +1000, Chris Smart via linux wrote:
> On Fri, 21 Jun 2019, at 23:41, Brenton Ross via linux wrote:
> 
> It occurs to me that a lot of software stores its user specific
> configurations in the ~/.config and ~/.local directories. If these
> are
> stored centrally then there could be conflicts when a user changes
> from
> one machine to another and the configuration data is then out of sync
> with the programs installed on the second machine.
> 
> Does anyone have any ideas on how to handle this ? 
> 
> 
> There hasn't traditionally been an agreed location for storing config
> in Linux, however the basedir spec from freedesktop is trying to
> address this[1].
> 
> "$XDG_DATA_HOME defines the base directory relative to which user
> specific data files should be stored. If $XDG_DATA_HOME is either not
> set or empty, a default equal to $HOME/.local/share should be used.
> 
> $XDG_CONFIG_HOME defines the base directory relative to which user
> specific configuration files should be stored. If $XDG_CONFIG_HOME is
> either not set or empty, a default equal to $HOME/.config should be
> used."
> 
> In theory you could try to set environment variables for each distro
> which changes these values to the distro's name (you could even add
> version). There are a few different locations where you could set
> this, for example:
> 
> /etc/profile.d/
> /etc/environment
> /etc/security/pam_env.conf
> 
>  e.g. on Fedora:
> 
> # cat > /etc/profile.d/basedir-overrides.sh << EOF
> source /etc/os-release
> export XDG_DATA_HOME="${HOME}/.config-${NAME,,}-${VERSION_ID}"
> export XDG_CONFIG_HOME="${HOME}/.local-${NAME,,}-${VERSION_ID}/share"
> EOF
> 
> This would set those locations to a distro-specific, e.g.
> 
> $ echo $XDG_DATA_HOME
> /home/csmart/.config-fedora-30
> 
> $ echo $XDG_CONFIG_HOME
> /home/csmart/.local-fedora-30/share
> 
> However, while I expect in general the desktops and a reasonable
> amount of software will respect that setting others won't.
> 
> Another idea might be to configure additional automounts for those
> XDG directory locations for each distro, which will store them in
> different locations in NFS.
> 
> You could also have different mount points for home for each distro
> but common mount points for top level dirs like ~/Documents, etc or
> just a ~/home/data-goes-here.
> 
> -c
> 
> [1] 
> https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
> 
> 
Thanks everyone for their thoughts.

A bit more background of the scenario:
The LAN is actually a group of virtual machines, not actual hardware.
Similarly, the user is just me, but I am also "virtualised" in that I
will be working under different user ids according to the role I am
taking - everyday use, development of a project, finance stuff, etc.

The VMs will be using different Linux distributions (and perhaps
different releases) as this is necessary to support the applications I
want to use. However, for each user I want to be able to access their
data files from any of the machines - hence the home directory will be
provided via NFS.

I have got LDAP working. I can see that it will be a bit of a pain to
use, but a few bash scripts should handle most of it.

I like the use of XDG environment variables. That would solve the
problem if they could be relied upon, but we all know that is never
going to be the case. So I will set them, but I need something else
that is a bit more certain.

My thinking at the moment (after sleeping on the problem) is use some
soft links, one of which would be in /run (or somewhere similar) and
would be set by the login script and point to the VM specific config
directory for the user. I will try to set this up and let you know how
it goes.

Thanks again for your thoughts.

Brenton





More information about the linux mailing list