Professional Web Applications Themes

bulk deleting users solaris 7 NIS - Linux / Unix Administration

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....

  1. #1

    Default 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.

    discussie@vandehoedenderand.nl Guest

  2. #2

    Default Re: bulk deleting users solaris 7 NIS

    On 2005-09-02, nl wrote: 

    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>
    Chris Guest

  3. #3

    Default 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.

    Birch Guest

  4. #4

    Default 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

    Birch Guest

Similar Threads

  1. deleting users
    By KG800 in forum Macromedia Contribute Connection Administrtion
    Replies: 1
    Last Post: March 17th, 09:04 PM
  2. Preventing Users from Deleting Drafts
    By RoseyGren in forum Macromedia Contribute General Discussion
    Replies: 3
    Last Post: February 22nd, 09:17 AM
  3. preventing (L)users from renaming/deleting icons on desktop?
    By Mike in forum Windows Setup, Administration & Security
    Replies: 2
    Last Post: August 5th, 10:05 PM
  4. Deleting all users, domains and workgroups
    By goodguy in forum Windows Setup, Administration & Security
    Replies: 3
    Last Post: July 1st, 01:29 PM
  5. Deleting some pre-installed users?
    By James Williams in forum Oracle Server
    Replies: 0
    Last Post: December 29th, 05:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139