LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 09-30-2007, 07:20 AM   #1
glopv2
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?

Thanks!
 
Old 09-30-2007, 07:29 AM   #2
puntjuh
Member
 
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 ambience.sk too clone user:

Code:
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, 07:30 AM   #3
tpetri1807
Member
 
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?

Edit:
Slow typer ;-)
 
Old 09-30-2007, 08:07 AM   #4
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
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:
Code:
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....
Code:
cp -R /home/fred/\. /home/newuser
chown -R newuser:newuser /home/newuser/\.
 
Old 10-03-2007, 09:06 PM   #5
glopv2
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, 09:19 PM   #6
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

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

http://wiki.linuxquestions.org/wiki/Adduser
Code:
I created  a user test2user using the above command,  here are the results

cat /etc/passwd
test2user:x:1003:100::/home/test2user:/bin/sh


cat /etc/group
cdrom:x:24:default,test2user
audio:x:29:default,test2user
users:x:100:


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 09:45 PM.
 
Old 10-03-2007, 09:20 PM   #7
SlowCoder
Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Fedora (Desktop), CentOS (Server), Knoppix (Diags)
Posts: 934

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 ...
http://www.ornl.gov/sci/techresource...g.shtml#humans
 
Old 10-04-2007, 04:23 AM   #8
glopv2
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, 04:24 AM   #9
glopv2
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....
 
  


Reply


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 06:09 PM
Linux server for disk cloning? lukeprog Linux - General 2 06-02-2006 03:25 PM
Cloning a Dual boot linux magnet Linux - Software 1 10-30-2005 07:04 AM
MAC address cloning in Linux sb73542 Linux - Security 1 08-02-2003 08:38 PM
cloning a harddisk on Linux gsbarry Linux - Software 17 04-24-2003 09:36 PM


All times are GMT -5. The time now is 04:17 AM.

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