09-03-05 07: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>
[ Post a follow-up to this message ]
|