bulk deleting users solaris 7 NIS - Unix

This is a discussion on bulk deleting users solaris 7 NIS - Unix ; 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 ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: bulk deleting users solaris 7 NIS

  1. bulk deleting users solaris 7 NIS

    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.


  2. Re: bulk deleting users solaris 7 NIS

    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
    ================================================== ================
    Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress


  3. Re: bulk deleting users solaris 7 NIS

    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.


  4. Re: bulk deleting users solaris 7 NIS

    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


+ Reply to Thread