Operating System - HP-UX
1830203 Members
19527 Online
109999 Solutions
New Discussion

Adding users (programmatically, in bulk, or via command line)

 
Christopher Caldwell
Honored Contributor

Adding users (programmatically, in bulk, or via command line)

HP-UX 10.20 or 11.0/Trusted

I've seen a lot of stuff on forums and Deja regarding useradd.sam. It works as advertised (sort of).

When the accounts are built, the accounts force the user to change their password on first login. We'd like to stick with the provisioned password, so users don't have to use telnet.

We want to build/manage user accounts end-to-end without the requiring the user to have telnet access.
They'll manage their password changes using alternative mechanisms that we provide.

I've tried manipulating the tcb entries using setprpwent to no avail. The docs don't really explain the API.

Anybody got ideas/pointers.
1 REPLY 1
Christopher Caldwell
Honored Contributor

Re: Adding users (programmatically, in bulk, or via command line)

I figured it out this evening. To get the users active, a little C program will help.

For a database record, updating the following fields will activate the account without forcing a user to telnet in or modify a password (after the user was added using useradd.sam:

/* Set the last successful password change to now */
mypr_passwdent.ufld.fd_schange=time(NULL);
/* Tell the tcb the last succesful password change field is set */
mypr_passwdent.uflg.fg_schange=1;