Unix administration - bulk deleting users solaris 7 NIS

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > September 2005 > bulk deleting users solaris 7 NIS





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author bulk deleting users solaris 7 NIS
discussie@vandehoedenderand.nl

2005-09-02, 5:57 pm

I have inherited the administration over a SUN Sparc Solaris machine
on a school. This machine has 2800 userids defined and only 1500 of
them are in use. How can I easily delete, (perlscript maybe?) my
surplus of 1300 userid from the NIS databases. I have managed to
compile a list of userids that can be removed so the input can be
read from file. Can you please point me in the right direction as
to how I can do that. Or better yet have a ready solution for me.

Thanks in advance.

Regards,
Peter Berkhout.

Chris F.A. Johnson

2005-09-03, 2:49 am

On 2005-09-02, discussie@vandehoedenderand.nl wrote:
> I have inherited the administration over a SUN Sparc Solaris machine
> on a school. This machine has 2800 userids defined and only 1500 of
> them are in use. How can I easily delete, (perlscript maybe?) my
> surplus of 1300 userid from the NIS databases. I have managed to
> compile a list of userids that can be removed so the input can be
> read from file. Can you please point me in the right direction as
> to how I can do that. Or better yet have a ready solution for me.


Make the entries in the file of the format:

^USERNAME1:
^USERNAME2:

If you just have the names by themselves, a simple awk script can
fix them:

awk '{printf "^%s:\n", $1}' FILE > FILENAME

And use:

grep -Evf FILENAME /var/yp/shadow > newshadow
mv newshadow /var/yp/shadow

Then build the NIS database.

On an older Solaris you may have to use egrep instead of grep -E.

Adjust file names to taste.

--
Chris F.A. Johnson <http://cfaj.freeshell.org>
========================================
==========================
Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
<http://www.torfree.net/~chris/books/cfaj/ssr.html>
Birch

2005-09-03, 7:50 am

Thank you very much for this solution. I will try this first thing
mondaymorning.
Do I need to do the same with /var/yp/passwd? Or will the makefile for
building the NIS database take charge of that?

Thanks again.

Regards,
Peter Berkhout.

Birch

2005-09-05, 6:00 pm

I did the task this mornig. All went well. To answer my own question.
Yes the same has to be done with the passwd file.
Thanks again.
Regards,
Peter Berkhout

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com