How to duplicate one user's desktop and program settings for another user?
I thought I had the right idea how to do this, but it didn't work. I have been using the root account for a lot of things since setting up Slackware (I know, bad idea . . .), mostly because I was building a lot of Slackbuilds and my build environment was in a directory I made called /home/Slackware. I did not know how to change the ownership of this directory so that other users could build in it, so I just kept using it as root.
I finally learned about the chown command and created a new "builder" group to which I gave group ownership of everything in my Slackware folder. I changed the group-owner permissions of everything in there to what the user-owner (root's) permissions had been before. Then I made my regular user a member of this group. So that's all fixed, I hope. However, now I have a root account with all the desktop and program configurations already set up, and I would like an easy way of transferring all of these preferences to my new user. I thought I could do it simply by copying the contents of the root directory to the new user's home directory like so Code:
cp -r /root/* /home/testuser/ Code:
chown -R testuser:users /home/testuser Thanks. |
desktop and relateds are stored in ~/.gconf and ~/.config
so Code:
cp -pr /root/.gconf/ /root/.config/ /home/testuser/ |
From man useradd:
Code:
-k, --skel SKEL_DIR https://github.com/kikinovak/desktop...source/profile Cheers, Niki |
Quote:
Code:
cp -r /root/{*,.*} /home/testuser/ |
Quote:
Code:
cp -r /root/{*,.[^.]*} /home/testuser/ Code:
find /root -mindepth 1 -maxdepth 1 -print0 | xargs -0 -I{} cp -r {} /home/testuser/ |
Quote:
Thanks for the correction! |
Thank you all very much. I tried Habitual's suggestion yesterday, and it duplicated the XFCE panel settings, but the fonts, desktop appearance, and all other program settings I have checked remain the same.
@astrogeek and T3slider: Thanks, I didn't realize I was not copying the hidden files. Would you mind telling me what that syntax is with the curly braces so I can read about it? I have not seen that sort of thing before. Also, I would not mind a comment on general advisability. Is there some reason I should avoid doing this? @kikinovak: That is very useful! I appreciate it. |
Quote:
The curly braces are a shell syntax that allows you to include a comma separated list of specifiers, usually filenames, along a common path. For example... Code:
cp /home/myname/somedir/{readme.txt,afile.txt,another.xml,something*} . Code:
cp /home/myname/somedir/readme.txt . And for completeness, using the corrected example T3slider gave... Code:
cp -r /root/{*,.[^.]*} /home/testuser/ My comment on the advisability of doing this was with the thought in mind that depending on the state of the system and all the vagueries of a given user's home directory, you might very well get some unexpected results such as session variables, locks, email caches, who knows what! So it is probably safe enough on a clean new home directory, but less so on a system in use. Use care. |
Quote:
And I will watch out for those issues you mentioned and be careful doing this sort of copy in the future. |
Quote:
|
Yay, it worked. I copied the profile successfully, but I wanted to post a follow up in case someone needs this in the future. It was not sufficient to change the permissions with
Code:
chown testuser:users /home/testuser/* -R Code:
shopt -s dotglob Thanks again to everyone who helped! |
Quote:
|
Quote:
Created a user, logged into KDE, set up some sane defaults. Copied the newly-created files to /etc/skel. Created more new users, logged into KDE, settings seemed to be as copied. But there were one or two files which, IIRC were specific to the original user, or had hard-coded paths in them. So, I just excluded those when copying to skel and most things seem to work. |
Quote:
This is a default bash command. Globbing is the way bash carries out filename expansion with wildcards. It does not use regular expressions, and it does not by default match strings starting with the dot to the wildcard character "*". However, you can change this (and get it to match strings starting with "." to "*") by using the shopt command I gave. Here is the relevant part of the bash manual: http://www.gnu.org/software/bash/man...-Shopt-Builtin :) |
All times are GMT -5. The time now is 10:32 PM. |