AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
  • 1.  adding multiple users to AIX server

    Posted Mon June 30, 2008 02:02 PM

    Originally posted by: BrentW


    I was given a list of about 40 new users to add to 25 AIX servers. What I would like to do is create a text file with the username and run a script to add them to the server.

    does anyone have a script that does something along those lines?

    Thank you !!


  • 2.  Re: adding multiple users to AIX server

    Posted Mon June 30, 2008 02:13 PM

    Originally posted by: unixgrl


    We do something like this:
    Our "build.accounts" file contains j1=TAG (which set of users)

    This is quicky ksh. You could use same logic in perl etc.
    <hr />

    [ && echo "Cannot access account
    list."

    while IFS=: read j1 id uid groups home shell gecos
    do
    idexists=`lsuser $id 2> /dev/null`
    if ; then
    pgrp=`echo $groups | awk -F\, '{print $1}'`
    && shell=/usr/bin/$shell
    mkuser id=$uid pgrp=$pgrp groups=$groups home=$home gecos=\"$gecos\"
    shell=$shell $id

    chuser account_locked=true $id
    else
    echo "User $id already exist."
    fi
    done < build.accounts


  • 3.  Re: adding multiple users to AIX server

    Posted Mon June 30, 2008 02:16 PM

    Originally posted by: unixgrl


    First line got lost in html

    
    [ && echo 
    "Cannot access account list."
    


  • 4.  Re: adding multiple users to AIX server

    Posted Tue July 01, 2008 01:16 PM

    Originally posted by: BrentW


    Ok.. thank you for the assistance :) :)

    I have one last question...

    For the mkuser command, what parameter of the command is used to load the "User Infomation" ?

    Thank you !!


  • 5.  Re: adding multiple users to AIX server

    Posted Tue July 01, 2008 01:39 PM

    Originally posted by: esv


    man mkuser


  • 6.  Re: adding multiple users to AIX server

    Posted Tue July 01, 2008 01:57 PM

    Originally posted by: BrentW


    man mkuser doesn't give the scripting parameters, which is why I asked here.. but thank you :)


  • 7.  Re: adding multiple users to AIX server



  • 8.  Re: adding multiple users to AIX server

    Posted Wed July 02, 2008 10:28 AM

    Originally posted by: SystemAdmin


    BrentW wrote:
    man mkuser doesn't give the scripting parameters, which is why I asked here.. but thank you :)

    man mkuser directs you to man chuser, so the parameter for the User Information is '-a gecos="User Name"


  • 9.  Re: adding multiple users to AIX server

    Posted Fri May 08, 2015 02:10 AM

    Originally posted by: tomkiat


    I use the mksuser this way sucking in the mulitple users from list

    # bulk create for users on AIX

    #

    cat users.lst | while read name gec

    do

      mkuser -a gecos="$gec" pgrp=staff groups=staff $name

    done

     

    #activate the account with password

    cat users.lst | while read name junk

    do

      passwd $name

      pwdadm -c $name

    done

    exit 0

    not elegant but does the trick