[KLUG Members] Time to rebuild

Adam Williams members@kalamazoolinux.org
Mon, 01 Sep 2003 16:35:14 -0400


> > OR you can make a copy of /etc/passwd & /etc/group before you nuke /. 
> > THen use adduser and friends to put them back.  
> I really have only two user accounts defined on this machine, one of
> which could disappear with no tears shed. I'm mainly just curious about
> handling multiple accounts in such a situation. If there were more than
> a few (like, three or more. I'm lazy), a script or other 'automagical'
> solution would be most appealing.

If you start enumating users at uidNumber 500, or some such, you can
pretty easily awk them out, and then back in after the install.

> > If you've got lots of users, then ask yourself why your nuking the box,
> > and is there a better way.
> See above, but that's really another question, one to which I haven't
> really seen many good answers beyond what little I've managed to find on
> the web: how to set up several machines on a network so one can log in
> at any one and see essentially the same common filesystem(s). I THINK I
> have the basic understanding behind that, but again, that's a different
> topic, one I'll save for another thread when I get brave enough to try
> pursuing it.
> > > If not, how are they preserved? I don't ask about passwords only
> > > because those probably should be changed on a reinstall anyway, but I
> > > could see that being a major issue if you had to restored, like,
> > dozens,
> > > hundreds... thousands of accounts... but anyway, and suggestions?
> > Don't store hundreds or thousands of accounts in a flat file.  If you do
> > your *@&(8 E$@(* &R@&@**@*(()@ insane anyway.  You store them in a
> > distributed and redundant directory service.  Be it LDAP, NIS,
> > whatever.  Although NIS sucks and LDAP rulez!
> Hrmm, different swear macro... *hehe!* 

Yep.

> But good point. I wasn't really
> thinking about that when I brought it up. Of course, I would be thinking
> LDAP WELL before that point, like, say, at 'dozens' (as in 'one dozen'),

Yep.

> but I'm still trying to sort out BASIC DNS, and my time ain't all that
> plentiful. One day, one day... 

DNS is fun.

> Anyway, it SOUNDS like all I'd need to do in the present situation is
> save those files and copy the one or two lines for the accounts in
> question back into the new /etc/passwd and /etc/shadow files after
> rebuilding the system? 

Yes,  but just the lines you want.  Don't copy back in the whole
file(s).

> Let me know if I'm missing something, but thanks
> to both of you for the info and advice!

So long as you don't create overlapping uidNumber or gidNumber values it
will work just fine.