Xfce Forum

Sub domains
 

You are not logged in.

#1 2008-11-13 01:30:36

fredfredfred
Member
Registered: 2007-06-18
Posts: 3

how to clone user settings and configuration?

I need to clone all of the settings in the root account to a less priveledged account (or always run as root, I suppose). Apparently, it isn't a simple matter of copying all the files in the /root/ directory to the new user's home directory and giving ownership of them to the new user. So how do I achieve this transfer?

Xfce version is 4.4.3, distro is Arch Linux.

Long explanation of what I tried:

I know one is not supposed to run as root. Out of laziness I recently set up a box, including X with XFCE4 as my desktop environment, from the root account. After I installed sudo I created a less privileged user, copied all of the files, including hidden files, from /root/ to /home/newuser/ and gave ownership of all files in /home/newuser (including the hidden ones) to newuser. Nonetheless, Xfce starts in a very basic configuration, incomplete, in fact. The cursor, for example, is the default xwm ugly X. When I kill X there are a number of errors on the screen that don't show up in the Xorg log file. Here are a couple examples:

(xfdesktop:5425): libxfce4util-CRITICAL **: Unable to create base directory /root/.cache/xfce4/desktop. Saving to file /root/.cache/xfce4/desktop/menu-cache--etc-xdg-xfce4-desktop-menu.xml.rc is likely to fail.

and

(xfdesktop:5425): libxfce4util-CRITICAL **: Unable to open file /root/.cache/xfce4/desktop/menu-cache--etc-xdg-xfce4-desktop-menu.xml.rc.5425.tmp for writing: Permission denied

What do I need to do?

Offline

#2 2008-11-13 15:10:23

s0ulslack
Member
From: Idaho
Registered: 2005-12-25
Posts: 291

Re: how to clone user settings and configuration?

Kinda obvious, some of the files must have /root as the home dir, grep/poke through ~/.config/ stuff and change as you find'em

Offline

#3 2008-11-13 17:18:43

eriefisher
Member
From: ON, Canada
Registered: 2008-10-25
Posts: 528

Re: how to clone user settings and configuration?

What should have happen when you created a new user was all the basic configurations are copied from /etc/skel and then you would start from there.


Siduction
Debian Sid
Xfce 4.18

Offline

#4 2008-11-13 21:58:17

s0ulslack
Member
From: Idaho
Registered: 2005-12-25
Posts: 291

Re: how to clone user settings and configuration?

I'm pretty sure settings aren't copied from /etc/skel/, rather /etc/xdg/xfce4, /usr/share/xfce4/ and a few other places

Offline

#5 2012-05-30 12:29:40

on4aa
Member
From: Hasselt, Belgium
Registered: 2012-05-30
Posts: 1

Re: how to clone user settings and configuration?

I wrote the following shell script to solve this issue. It worked fine for me on several occasions.

Copy the code into a text editor and save it as copy-config2user
Make the file executable with chmod +x copy-config2user
Execute it by typing ./copy-config2user USERNAME at the command line.

The script is very safe to use as it has some built-in checks.
One can add more copyitem lines to copy the configuration of other programs as well.

#!/bin/bash

<<DESCRIPTION
    copy-config2user is a shell command that copies one's desktop configuration files 
    to another specified user.

    Usage: copy-config2user USERNAME
DESCRIPTION

<<COPYRIGHT
    Copyright (C) 2012  Serge YMR Stroobandt

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
COPYRIGHT

<<CONTACT
    See user on4aa on https://forum.xfce.org/viewtopic.php?id=4168
CONTACT

TOUSER=$1

function copyitem() {
	ITEM=$1

	echo; echo "Deleting $ITEM of user $TOUSER..."
	sudo rm -Rv /home/$TOUSER/$ITEM

	echo; echo "Copying $ITEM of user $USER to user $TOUSER..."
	sudo cp -av /home/$USER/$ITEM /home/$TOUSER/$ITEM
	sudo chown -R $TOUSER:$TOUSER /home/$TOUSER/$ITEM
}

if [ -z $1 ] || ! [ -d /home/$TOUSER ] || [ $USER = $TOUSER ]; then
	echo "Please, specify the user who will receive your desktop configuration."
else
	copyitem ".config/autostart/"
	copyitem ".config/Terminal/"
	copyitem ".config/Thunar/"
	copyitem ".config/xfce4/"
fi

Last edited by on4aa (2012-05-30 19:14:55)


Are my methods unsound?
Have you ever considered any real freedoms? Freedoms from the opinion of others... even the opinions of yourself?

Colonel Walter E. Kurtz in "Apocalypse Now"

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.012 seconds, 7 queries executed - Memory usage: 534.7 KiB (Peak: 535.33 KiB) ]