Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-30-2007, 06:20 AM   #1
LQ Newbie
Registered: Sep 2007
Posts: 14

Rep: Reputation: 0
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?

Old 09-30-2007, 06:29 AM   #2
Registered: Apr 2006
Location: holland
Distribution: Gentoo / debian / suse / mint
Posts: 558

Rep: Reputation: 42
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.
Old 09-30-2007, 06:30 AM   #3
Registered: Jan 2006
Location: Frankfurt, Germany
Distribution: Fedora Core 6, Kubuntu 7.04
Posts: 60

Rep: Reputation: 15
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 ;-)
Old 09-30-2007, 07:07 AM   #4
Senior Member
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
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/\.
Old 10-03-2007, 08:06 PM   #5
LQ Newbie
Registered: Sep 2007
Posts: 14

Original Poster
Rep: Reputation: 0
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
Old 10-03-2007, 08:19 PM   #6
LQ Guru
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,247
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
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

Last edited by farslayer; 10-03-2007 at 08:45 PM.
Old 10-03-2007, 08:20 PM   #7
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Ubuntu, Mint
Posts: 939

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

Read here for more info ...
Old 10-04-2007, 03:23 AM   #8
LQ Newbie
Registered: Sep 2007
Posts: 14

Original Poster
Rep: Reputation: 0
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.
Old 10-04-2007, 03:24 AM   #9
LQ Newbie
Registered: Sep 2007
Posts: 14

Original Poster
Rep: Reputation: 0
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....


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cloning Linux System from PC->PC ALInux Linux - General 4 07-26-2006 05:09 PM
Linux server for disk cloning? lukeprog Linux - General 2 06-02-2006 02:25 PM
Cloning a Dual boot linux magnet Linux - Software 1 10-30-2005 06:04 AM
MAC address cloning in Linux sb73542 Linux - Security 1 08-02-2003 07:38 PM
cloning a harddisk on Linux gsbarry Linux - Software 17 04-24-2003 08:36 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:57 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration