1752554 Members
4821 Online
108788 Solutions
New Discussion юеВ

User ID creations

 
Viney Kumar
Regular Advisor

User ID creations

Hi all

I want to preaper a script for userid creation creation on diffrent platform like aix, hp-ux and solaris with gid,home dir location,comment information.

can any body help me on it

Regards
Viney Kumar
7 REPLIES 7
SANTOSH S. MHASKAR
Trusted Contributor

Re: User ID creations

Hi,

use useradd command

# useradd -u -g -d -s -c -m -k <skel_dir> <login_name><BR /><BR />Also see man useradd<BR /><BR /><BR />Regards<BR /><BR />-Santosh
Steven E. Protter
Exalted Contributor

Re: User ID creations

Shalom,

Me and my pal google will help out.

http://www.unix.com/hp-ux/35414-user-creation-2nd-server.html

http://lists.samba.org/archive/samba-technical/2000-July/008701.html

Like this best:
http://nixcraft.com/hp-ux/742-hp-ux-create-add-users-command-line-using-useradd.html

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Viney Kumar
Regular Advisor

Re: User ID creations

thanks for ur reply but my requirement some wide.

I need to create some 135 users on 250 different platform servers and so how we can create a common script for user creation for all platform
James R. Ferguson
Acclaimed Contributor

Re: User ID creations

Hi Viney:

> I need to create some 135 users on 250 different platform servers and so how we can create a common script for user creation for all platform

I would create a script like this:

# ./addusers
#!/usr/bin/sh
set -u
umask 022
typeset INFILE=$1
typeset OLDIFS=${IFS}
IFS=":"
while read UID NAME GECOS X
do
useradd -u ${UID} -g 20 -s /usr/bin/sh -c "${GECOS}" -m ${NAME}
done < ${INFILE}
IFS=${OLDIFS}
exit 0

...now create an input file that looks like:

# cat ./userstoadd
1000:newuser1:some new user-1
1001:newuser2:some new user-2
1002:newuser3:some new user-3

...and run as:

# ./addusers ./userstoadd

If you need to vary the group or any other parameters, amend the script to fetch addition fields from the input file and add the colon-delimited field to the input too.

Regards!

...JRF...
OldSchool
Honored Contributor

Re: User ID creations

"I want to preaper a script for userid creation creation on diffrent platform like aix, hp-ux and solaris with gid,home dir location,comment information."

I'd think someone would have looked a LDAP, or NIS+ or ? to manage this. That's way to many servers to manange manually IMHO.

points to note:

useradd on AIX is markedly different than HP's version. No clue what Solaris uses, but it might be different as well.

JRF's script will work nicely for the HP-UX boxes. It could be extended to read a list of (HP) servers, access each in turn and add the users.

that in turn could be extended to read a list of AIX servers, access them and run the appropriate command there as well...then Solaris, using whatever it uses.

With that many servers, I'd be concerned that there will be userid collisions (i.e. login id abc123 has uid 1023 one place, and on another server its 2032 or some such. you'll have to verify that the uid range of the "new" ids isn't in use already on each server.......
James R. Ferguson
Acclaimed Contributor

Re: User ID creations

Hi (again):

OldSchool's comments are very well taken. In the light of the various platforms you mentioned, I recalled a very feature rich script offered by Dusan Baljevic (otherwise known as 'V2KCOT'). He posted it here:

http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1138307

Regards!

...JRF...
Suraj K Sankari
Honored Contributor

Re: User ID creations

Hi,

Please assign some points who give there valuable time for your problem.

To know how to assign points please go through the below link.


http://forums13.itrc.hp.com/service/forums/helptips.do?#33

Suraj