The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > AIX
Google UNIX.COM


AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Creating user accounts Redditt90kg UNIX for Dummies Questions & Answers 0 07-29-2006 06:44 PM
Limiting length of user in while creating user Satya Mishra AIX 2 04-14-2005 11:40 PM
creating a new user rocker40 UNIX for Dummies Questions & Answers 7 05-04-2004 01:33 PM
creating user accounts in AIX pdepa UNIX for Advanced & Expert Users 3 01-16-2004 06:59 AM
creating a new user Newbie4ever UNIX for Dummies Questions & Answers 3 07-27-2002 06:51 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 04-08-2008
Registered User
 

Join Date: Oct 2007
Posts: 289
script for creating aix user

Hi Guys,

I want to create user with a script:

user name, user id, primary group, group set, home directory, initial program, password, user information, another user can SU to user. And all the rest is the default.

Does anyone already have the script for this? Can you please share it with me and the rest on the group.

Thanks in advance,
itik
Reply With Quote
Forum Sponsor
  #2  
Old 04-08-2008
Yac Yac is offline
Registered User
 

Join Date: Sep 2007
Posts: 8
Hi,
Enter in command line: smitty user, choose Add a User. Then enter necessary information ie. name, groups etc. Finally press F6 and you'll get the complete script.

Greets,
Yac.
Reply With Quote
  #3  
Old 04-09-2008
Registered User
 

Join Date: Mar 2008
Posts: 28
If you wish to automate user creation, first, as Yac suggests, create a user with "smitty user". Then copy the relevant parts of the smit.script and make them work for your needs.
Reply With Quote
  #4  
Old 04-10-2008
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,262
@prichard & Yac: Sorry, but i do not think it is that simple. To be useful such a script will have to deal with several error conditions. What you get out of "smitty user" is simply a wrapper for the "mkuser" command.

For instance assume the following situation: The script is called to create a user "foo" with UID 42. The following errors now could occur and should be reported back with different error levels from the script:

- a user "foo" exists already with uid=42 (=the user exists)

- a user "foo" exists with uid=43 (username already taken)

- a user "bar" exists with uid=42 (userid already taken)

- a user "foo" with uid=43 and a user "bar" with uid=42 exist already

How about other errors, like (unsorted): the script not being called by root, unable to create the home directory, the username is not a legal one, the uid is not legal, ..... (and i don't even mention the errors connected with the group memberships)

True, the last step would be to call "mkuser" and be done, but the necessary checks before look like an interesting programming task.

I hope this helps.

bakunin
Reply With Quote
  #5  
Old 04-10-2008
Registered User
 

Join Date: Mar 2008
Posts: 28
I did not say it would be simple. I just said that one can make the smit.script work for their needs. It is a starting point for automation. Until one understands what to check for one should stay with "smitty user" since it checks all that stuff for you. Very powerful.
Reply With Quote
  #6  
Old 04-10-2008
Registered User
 

Join Date: Oct 2007
Posts: 289
Thank you for all your input.

I guess, I would be the first one to create the script. I'll share it when I'm done. It's hard adding hundreds of user manually or smitty, I really need to do it in a script.

Is there a danger of editing manually all these files?

/usr/lib/security/mkuser.default Contains the default values for new users.
/etc/passwd Contains the basic attributes of users.
/etc/security/user Contains the extended attributes of users.
/etc/security/user.roles Contains the administrative role attributes of users.
/etc/security/passwd Contains password information.
/etc/security/limits Defines resource quotas and limits for each user.
/etc/security/environ Contains the environment attributes of users.
/etc/group Contains the basic attributes of groups.
/etc/security/group Contains the extended attributes of groups.
/etc/security/.ids Contains standard and administrative user IDs and group IDs.

Last edited by itik; 04-10-2008 at 09:08 AM.
Reply With Quote
  #7  
Old 04-10-2008
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,262
Quote:
Originally Posted by itik View Post
Is there a danger of editing manually all these files?
No, there is not, but IMHO it ist still preferable to do it with the AIX commands, namely mkuser.

I already attempted what you do now and can provide you with a script function to check some of the mentioned conditions. I will put it in here later this afternoon.

bakunin
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 07:04 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0