Clone UNIX IDs
I need to clone groups and IDs from one server to another.
I need to clean some items up in the process. Has anyone ever scripted the dump of /etc/passwd and /etc/group files to useradd and groupadd commands? I'm not much of a pearl programmer and my ksh scripting is light as well. Any assistance is greatly appreciated!!!!! Thanks!!! |
Why do you need to use useradd/groupadd? Just copy the entries from /etc/passwd, /etc/shadow, and /etc/group from one server to the other.
HTH Forrest |
I need to script this process as I will be cloning multiple different environment as we create a new datacenter.
Using the useradd and groupadd commands simplifies the process of creating Groups, IDs, home directories and setting secondary groups. Additionally once the dump to useradd command scripts is complete, I can easily perform some editing when required. If I was only doing a few servers then I would clone via the files themselves. Thanks, Chris |
Looking out for the "gotchas" ...
How many of the target systems already exist and have more than base installation users and groups? I'm wondering if any of the user and group numeric IDs are used on different systems for different purposes. Why scripting it and using local files rather than using NIS or NIS+? What have you tried already? It's a fairly straightforward task in any of the scripting languages except "I need to clean some items up in the process" cannot be coded! LQ usually provides a helping hand rather than a hand out. |
I'd recommend Perl, it's good at text wrangling, plus you can get it to login via ssh and run the reqd cmds remotely.
Start here: http://perldoc.perl.org/ http://www.perlmonks.org/?node=Tutorials You'll need to be very clear on the details of what you are trying to achieve before you start programming... Of course if you can use a central auth like OpenLDAP, that would be easier. |
Moved to Server for more adequate exposure.
|
All times are GMT -5. The time now is 02:56 PM. |