Results 1 to 5 of 5

Thread: ??? Clone a user to a different name ???

  1. #1
    Senior Member registered user
    Join Date
    Dec 2003
    Location
    Salt Lake City, UT, U.S.A.
    Posts
    1,338

    ??? Clone a user to a different name ???

    Ok, I guess this is REALLY a noob question, cause I've had it posted in the newsgroup I thought it should be in, and it hasn't gotten any responses -=- So, I am cross-posting into the HD Install -=- to get an answer...

    Included Cross-Posted Networking Newsgroup post:

    Pardon my noob issue, but, with Knoppix, I've been thrust into being an account manager now...

    I want to duplicate a current user into another name.

    Issue #1 - Can I "copy" or duplicate a user I have setup as a template - lets say "knoppix" for an example - Can I copy that account and user as a different name? If so, can they share the same /home or do they need a different home directory??? Will all the access and permissions copy as well?

    Issue #2 - Can a directory be created that is shared across all users, write, read, and exec, that DOESN'T exist in someones home directory? Or can this only be done in ones home area?

    Please explain resolution in simp terms - I went into this role kicking and scratching...
    Thanks for any assistance,
    Cuddles
    [ps] Knoppix 3.3 v2.4.22-xfs HD Install, non-dualboot, 40gig HD.

  2. #2
    Member registered user
    Join Date
    May 2003
    Posts
    35

    Re: ??? Clone a user to a different name ???

    Quote Originally Posted by Cuddles
    Ok, I guess this is REALLY a noob question, cause I've had it posted in the newsgroup I thought it should be in, and it hasn't gotten any responses -=- So, I am cross-posting into the HD Install -=- to get an answer...

    Included Cross-Posted Networking Newsgroup post:

    Pardon my noob issue, but, with Knoppix, I've been thrust into being an account manager now...

    I want to duplicate a current user into another name.

    Issue #1 - Can I "copy" or duplicate a user I have setup as a template - lets say "knoppix" for an example - Can I copy that account and user as a different name? If so, can they share the same /home or do they need a different home directory??? Will all the access and permissions copy as well?

    Issue #2 - Can a directory be created that is shared across all users, write, read, and exec, that DOESN'T exist in someones home directory? Or can this only be done in ones home area?

    Please explain resolution in simp terms - I went into this role kicking and scratching...
    Thanks for any assistance,
    Cuddles
    [ps] Knoppix 3.3 v2.4.22-xfs HD Install, non-dualboot, 40gig HD.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    I'll take a stab.

    #1 ) First, yes you can copy a users profile and it will typically work fine as long as it doesn't contain any HARD coded file paths in any of the files rather than the tilde shortcut to home - i.e. /home/knoppix/setup.conf rather than ~/setup.conf.

    First use some utility to make the user, the adduser command or the user tool in KDE.

    Copy the knoppix dir contents to the created users folder, say it's name is ralph, Then as root from the /home dir issue this command:

    Code:
    chown -R ralph.ralph ralph/
    This should allow ralph to login with the same basic setup as knoppix.

    #2 ) Yes, you can make ANY folder "world readable" that is writable to anyone - as long as the media supports it. You certainly can't make a folder on the CD writable. Make a folder, say named barf, and as root change it's rights from the folders parents:
    Code:
    chmod 777 barf/
    If it's a pre-existing folder with contents do this:
    Code:
    chmod -R 777 barf/
    to recurese the folder and change the files contents attributes.

    ONE TIP: Try out Midnight Commander, type mc at the term prompt . if you're familiar with the old Norton Commander back in the "good ol' days" of DOS it is much the same. You can navigate, read, edit and change attributes very easily.

  3. #3
    Senior Member registered user
    Join Date
    Jan 2004
    Location
    Paris, France
    Posts
    203

    What exactly

    What exactly do you wanna do.
    immediately and then later......

    you can change a username over. say you have knoppix but you want it to be cuddles then you can just change the name and it should keep the same uid (the important bit behind the name)
    Files prevuiously written by knoppix might still be shown owned by knoppix but the actual permissions will be fine for cuddles.

    You can also create groups (like say admin or users)
    An owner belogs to at least one group but can belong to more.

    All of this is in three files...
    /etc/passwd
    /etc/group
    /etc/shadow

    (shadow contains a MD5 hash encrypted password)
    The easiest way to bulk create users is copying users in the passwd file
    if you copy and just change the username then they will have the same home directory and the same groups as the original user you copied

    You might wanna create a /home/users for instance and then edit the template user to point to this directory. The directory needs to have priviliges set for the whole group users.
    An easy way is to change the ownership of the directory to users

    chown /home/users users
    and set group permissions
    chmod 772 /home/users

    there are lots of ways and it depends how many users and if you really wanna share a home directory which kinda defeats the object of it being 'home'

  4. #4
    Senior Member registered user
    Join Date
    Dec 2003
    Location
    Salt Lake City, UT, U.S.A.
    Posts
    1,338
    Gowator,

    "what do I want to do exactly, and immediately and later..."

    This is what I want to do, now, and later...

    I have setup my "knoppix" login to exactly what I want a "new user" account to have, shortcuts on the desktop, dial-up information, KMail configuration, Mozilla settings and bookmarks, and even the "basic" simple starter address book for KMail. I have set up the taskbar, appearance, behavior, sound settings and sound effects, and even the Region and Time settings, in this "knoppix" user account.

    I want to use this knoppix account to make other user accounts - since it is set up as a "starting point" for any user I will have on the system - currently, and in the future. I don't have to have all the users "share" a common /home folder/directory for this, but I do want to get the "template" common (at least to start a new user out on) to any users that I have, or will have, on the system.

    The "standard" adduser, or KDE's KUser utility, creates a desktop with only a floppy drive and a trashcan - the system these users will be on has a hard drive, a floppy drive, a Flash rewritter, a DVD drive, and a CDRW drive. All of which have to manually be created on the desktop for each user. The Region and Keyboard information always generates a GERMAN keyboard, and the time zone is who knows what. I have to manually set those in each account, and even manually setup the dial-up connection, email, and create the bookmarks, not to mention having to recreate the email address book for each user as well.

    I am not into manual labor, especially if I have a user account already set up with all these "default" settings, and just need to "duplicate" them to a new user. That way the new user has the same "starting point", and can change it from that point.

    Doesn't it make sense, create a "template" user account - with all the settings made, with all the configurations done, with the dial-up already working, and the desktop set to the "average" user on the system - and then just "copy" this template to new users when you add them?

    I do agree with you on the /home issue though - I don't think that is really the answer I was looking for, or to do - A single user account should only change that single users area, global account changing isn't the area I was looking to getting into, unless I set a "global data" area, set specifically for all users in a group to access, but thats different.

    Cuddles

  5. #5
    Senior Member registered user
    Join Date
    Jan 2004
    Location
    Paris, France
    Posts
    203

    OK here goes then

    Thanks cuddles....
    Its a bit clearer now....
    Bearing in mind Ive been using Knoppix for less than a week and my Debian specific knowledge is limited here's what I'd do. Just using generic linux!!

    1) You have your account.... knoppix. Everything is fine keyboard, sound etc
    2) Create a new user.... the GUI tools will do it or use the CLI method which works too.
    (see earlier post)
    3) I'd really recommend a different home. Your asking for more problems with things like Mozilla etc. becuase it puts lock files in the home directory. Non of these are insurmountable BUT why give your self the hassle... if a user deletes a desktop item it will delete everyones !!

    4) Presuming you create the user by the CLI method the home directory isn't automatically created. kadduser etc. will do this automatically by default but it will be the one you don't want.
    In the CLI create the /home/cuddles instead of the /home/knoppix
    this just says where it will be, it doesn't actually create it.

    5) Presuming the user exists, has a password etc. then you can add the home directories just by copying the knoppix directory.

    su - cuddles
    This makes you cuddles in this console
    (it might complain about not having a home directory)
    cp -r /home/knoppix /home/cuddles
    Now you have the desktop, all the sound settings and everything created.

    -r means recursive, it will copy everything under the /home/knoppix
    I think it should create the directory /home/cuddles (if not then mkdir /home/cuddles)

    Copying it as cuddles will make cuddles the owner automatically. The file permissions will be the default for the user, this is set by the UMASK envvar ..

    An alternative way is to do it as root (which you need to be to edit the passwd and shadown files in /etc anyway)

    You need to decide whether you create a new group per user or put all users in a single group (like users), i prefer the latter.
    Assuming users exists as a group then you can copy the files with their permissions intact with
    cp -rp /home/knoppix /home/cuddles
    then change the owner and group of /home/cuddles and ALL files under it with
    chuser -R cuddles:users /home/cuddles
    Capital R this time for recursive
    the cuddles:users is what you are changing it to.

    Hope that helps .....

Similar Threads

  1. 7 days to clone 250GB HDD - What am I doing wrong?
    By Highland in forum General Support
    Replies: 8
    Last Post: 03-24-2005, 03:53 PM
  2. Windows user now... Linux user tommorow?
    By zspecfenix17 in forum The Lounge
    Replies: 7
    Last Post: 03-10-2005, 05:58 PM
  3. Replies: 2
    Last Post: 04-07-2004, 03:51 AM
  4. Make new user with same configs as current user?
    By SunnyB in forum General Support
    Replies: 4
    Last Post: 03-09-2004, 02:02 PM
  5. Clone Win Drive?
    By iconfly in forum General Support
    Replies: 2
    Last Post: 05-13-2003, 09:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •