View Full Version : SYS ADMIN GURU'S: Is there a command on Redhat/fedora to copy a user?
chewmanfoo
27th May 2004, 09:46 PM
I have a user I want to copy exactly - so that I may grant another the privs/access of my user, but not have to share my password with them. How can I do this? Is there a copyuser command or some equivalent?
ghenry
27th May 2004, 11:07 PM
What about using system-config-users gui and looking at the properties and then copying them?
The other way is to use a script and copy them that way.
jimbo
27th May 2004, 11:31 PM
The best way to manage how user settings are created when adding a new user is to make use of the /etc/skel method. Files copied into /etc/skel will be added to the new user's home directory when he/she is created. This is a good place to put a "Desktop" diretory. You can also put things like .profile or .bashrc files or even .kde or .nautilus configuration directories.
You should use caution however as anything you put there is copied to each new user's home directory and if you've got a reference to, say, a specific user's file structure you will get permission errors as user jane can't access user joe's home directory. So make sure of what you are putting into /etc/skel so everything is somewhat generic and files that are referenced, such as corporate wallpapers and such are in a location that is readable by all.
I usually create a "sample" user so I can go into a clean default user environment and setup the applications and desktop etc. how I like it and then copy it to /etc/skel. Of course I then delete the "sample" user.
You can google for "/etc/skel" for more info.
PS. /etc/skel is empty by default.
ghenry
27th May 2004, 11:44 PM
Ah, I picked up on the question wrong, this is of course the correct way to do things.
chewmanfoo
28th May 2004, 01:00 PM
I need to duplicate a particular user. Can this be done? From the command line?
boyzonder
28th May 2004, 11:41 PM
How about first adding the user to your to-be-installed-on system. Then (as root) copy the user's directory (found in /home/$user) from the old system to /home/$user on the new system. You could use Midnight Commander (mc) for this, or a command line like this:
cp -bir $old_userhome $new_userhome
(-bir makes sure that all files/directories get copied and that you're prompted for overwrites, the variables $old_userhome and $new_userhome of course should be pointing to real directories).
You probably will get prompted if you wish to overwrite some files. Do this only if you're sure you need the old ones! Using old configuration files which are not compatible with newer software versions might cause trouble.
Finally, as root, make your new user the owner of all files in his home directory. If your user was called "john" and were in the group "users", then you'd say:
chown john.users /home/john -R
This would make john.users the owner of all files and subdirectories of /home/john.
Hope this answers your question!
(and hope it works :-)
chewmanfoo
29th May 2004, 01:06 PM
Thanks guys, really.
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.