-   Linux - Newbie (
-   -   cloning a linux user (

glopv2 09-30-2007 06:20 AM

cloning a linux user
Is it possible to "clone" a linux user with useradd? My problem is, when I create a new user who isn't the original user, then:
1) The sound doesn't work
2) The menu bars aren't the same
3) The internet/wireless icon doesn't show up

My main problem is that the sound doesn't work. Weird?


puntjuh 09-30-2007 06:29 AM

The sound problem might be caused by the new user not beeing in the group "sound".

And here's a little guide from too clone user:


How to copy / clone user account in Linux?

Task: Copy / clone user account, so the both users have the very same settings in their user home directory.

Copying of the user's home directory (e.g. olduser) to new user (e.g. newuser) is easy:
1. Create new user: adduser newuser
2. Copy all special hidden (dot) files to new user's home directory: cp --recursive /home/olduser/.[a-zA-Z0-9]* /home/newuser
3. Copy other standard files to new user directory: cp --recursive /home/olduser/* /home/newuser
4. Set new user's directory and files owner to new user for hidden dot files: chown --recursive newuser:users /home/newuser/.*
5. Set new user's directory and files owner to new user for normal files: chown --recursive newuser:users /home/newuser/*

You are done. In some cases you would need to change user group (users in this case).

Now just logout and try to login as the new user. All the settings for the programs should be the very same as for the old user. You can for example compare the settings by running KDE and checking the wallpaper and other settings of the new user. If the copying of the user folder was successful, everything will look the same.

tpetri1807 09-30-2007 06:30 AM

I guess it would be possible to create the new user, and then copy all the hidden folders (the ones that contain the user configuration for each piece of software) from the first user's home folder to the new user's. But wouldn't it make more sense to work on the core problem about the sound?

Slow typer ;-)

homey 09-30-2007 07:07 AM

Since new users get the settings from /etc/skel , I just copy my template user over to that. Kinda doubt you want all users to have the same email account so, I exclude that.
For example:

rm -rf /etc/skel
mkdir /etc/skel
rsync -av --exclude='.thunderbird' /home/fred/ /etc/skel

You could also just copy from one user to the other....

cp -R /home/fred/\. /home/newuser
chown -R newuser:newuser /home/newuser/\.

glopv2 10-03-2007 08:06 PM

I followed the instructions, but I've run into this problem:
when I am in /home/user2, I type "sudo chown -RP user2 *" and "sudo chown -RP user2 .*" and all the files become owned by user2. BUT, when I go back into /home/user1 all of THOSE files are now owned by user2! So I do the same thing to change them back, but again. I don't understand why changing them in one directory is changing them in the other directory?

If I omit the "-R", it works, but of course, it only changes the top level directories. I still can't log on as user2, because the files in the directories are owned by user1.

Thanks in advance

farslayer 10-03-2007 08:19 PM

When you create the new user what groups are they in, and what group has rights to sound ? why not just add them to the audio group on creation ?

useradd -g users -G audio,cdrom -m username

useradd -g <initial_Group> -G <supplemental_group(s)> -m(create_home_dir) Username

I created  a user test2user using the above command,  here are the results

cat /etc/passwd


cat /etc/group

useradd -D to see defaults used when creating a new user
edit /etc/default/useradd to edit and change defaults

SlowCoder 10-03-2007 08:20 PM

Seems possible, but not easily or cheaply. And the government doesn't seem to like it either.

Read here for more info ...

glopv2 10-04-2007 03:23 AM

I think the greatest hindrance to cloning is this key problem: What do you name the clone? You can't give it your own name, but at the same time, is another name satisfactory? The Prestige is a movie that makes good headway on this.

glopv2 10-04-2007 03:24 AM

oh, and thank you very much for the help, I've been able to create a new user. Although I still don't get why chowning in one directory recursively would change the ownership of files in a neighboring directory....

All times are GMT -5. The time now is 09:40 AM.