LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-16-2009, 02:00 PM   #1
cgraham1
LQ Newbie
 
Registered: Jun 2009
Location: Schaumburg IL
Posts: 7

Rep: Reputation: 0
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!!!
 
Old 09-16-2009, 02:10 PM   #2
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
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
 
Old 09-16-2009, 04:03 PM   #3
cgraham1
LQ Newbie
 
Registered: Jun 2009
Location: Schaumburg IL
Posts: 7

Original Poster
Rep: Reputation: 0
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
 
Old 09-16-2009, 04:27 PM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
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.
 
Old 09-16-2009, 08:45 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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.
 
Old 09-17-2009, 01:02 AM   #6
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Moved to Server for more adequate exposure.
 
  


Reply



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
clone sco-unix HTFS hd llamatoes Other *NIX 2 08-07-2010 10:32 AM
I need to Clone a Red Hat drive and install clone in HP server drummer54 Linux - Newbie 14 03-07-2009 04:15 PM
bugzilla: to clone, or not to clone? The00Dustin Linux - Newbie 1 05-24-2008 05:19 AM
adding pci device ids to pci.ids xerxex Linux - General 0 01-18-2006 06:36 PM
a mirabilis icq clone for unix keevitaja Linux - Software 1 08-28-2002 12:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:18 PM.

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
Open Source Consulting | Domain Registration