From: Joe C. <jo...@sw...> - 2001-03-26 10:32:31
|
Quick query, What /needs/ to be in %user when using the &create_user function from useradmin? Here's the situation, I want to create a user from a template, with only a username selected by the admin at creation time. The template will be hardcoded at first, but soon replaced by module config options or some other interactive setup method. But, it will not be specific to each user. I'd like to accomplish the following: Insert the name which is being chosen at create time Create a random password which is encrypted using the standard Red Hat PAM method -- (I'll probably also add a field for entering an optional password later) Select the next available user ID (I think I've successfully pulled this mostly unaltered from the edit_user.cgi section) Set everything else to 'defaults' as defined in the template I'm already successfully creating the new user's home directory, and I think I can figure out adding ACLs for the user for Webmin (haven't tried to tackle adding a Webmin user yet). What I'm trying to figure out is, what needs to be specified in the %user hash when calling create_user? As I mentioned, the details of the user will not be chosen on a per-user basis so I definitely don't need all the funny bits being checked and configured in useradmin, but I want to make sure I'm creating a functional and completely defined user. Thanks! -- Joe Cooper <jo...@sw...> Affordable Web Caching Proxy Appliances http://www.swelltech.com |
From: Jamie C. <jca...@we...> - 2001-03-27 00:32:40
|
Joe Cooper wrote: > > Quick query, > > What /needs/ to be in %user when using the &create_user function from > useradmin? > > Here's the situation, I want to create a user from a template, with only > a username selected by the admin at creation time. The template will be > hardcoded at first, but soon replaced by module config options or some > other interactive setup method. But, it will not be specific to each > user. I'd like to accomplish the following: > > Insert the name which is being chosen at create time > > Create a random password which is encrypted using the standard Red Hat > PAM method -- (I'll probably also add a field for entering an optional > password later) > > Select the next available user ID (I think I've successfully pulled this > mostly unaltered from the edit_user.cgi section) > > Set everything else to 'defaults' as defined in the template > > I'm already successfully creating the new user's home directory, and I > think I can figure out adding ACLs for the user for Webmin (haven't > tried to tackle adding a Webmin user yet). > > What I'm trying to figure out is, what needs to be specified in the > %user hash when calling create_user? As I mentioned, the details of the > user will not be chosen on a per-user basis so I definitely don't need > all the funny bits being checked and configured in useradmin, but I want > to make sure I'm creating a functional and completely defined user. The hash keys that need to be in %user are : user - The username pass - The encrypted password (you should call encrypt_password to generate this) uid - The user's UID gid - The GID of the user's primary group real - The user's real name home - Home directory shell - The user's shell In addition, if your system supports the shadow password file you also set the following keys if you want (if not, they will just be left empty which is the default) change - Days since 1st jan 1970 that password was changed min - Days before password may be changed max - Days after which password must be changed warn - Days before password is to expire that user is warned inactive- The number of days of inactivity allowed for the user expire - Days since Jan 1, 1970 that account is disabled - Jamie |
From: Joe C. <jo...@sw...> - 2001-03-27 00:58:17
|
Thanks a heap, Jamie. That makes it downright easy. Jamie Cameron wrote: >> What I'm trying to figure out is, what needs to be specified in the >> %user hash when calling create_user? As I mentioned, the details of the >> user will not be chosen on a per-user basis so I definitely don't need >> all the funny bits being checked and configured in useradmin, but I want >> to make sure I'm creating a functional and completely defined user. > > > The hash keys that need to be in %user are : > > user - The username > pass - The encrypted password (you should call encrypt_password to generate this) > uid - The user's UID > gid - The GID of the user's primary group > real - The user's real name > home - Home directory > shell - The user's shell > > In addition, if your system supports the shadow password file you also set the following > keys if you want (if not, they will just be left empty which is the default) > > change - Days since 1st jan 1970 that password was changed > min - Days before password may be changed > max - Days after which password must be changed > warn - Days before password is to expire that user is warned > inactive- The number of days of inactivity allowed for the user > expire - Days since Jan 1, 1970 that account is disabled > > - Jamie > > - > Forwarded by the Webmin development list at web...@we... > To remove yourself from this list, go to > http://lists.sourceforge.net/lists/listinfo/webadmin-devel -- -- Joe Cooper <jo...@sw...> Affordable Web Caching Proxy Appliances http://www.swelltech.com |
From: Joe C. <jo...@sw...> - 2001-03-27 07:38:00
|
Ok... I'm almost there. But I'm stumped now. My perl ignorance is showing. Is there a way for me to pass the hash to a foreign_call? I've confirmed that everything is correct in the hashes (%user and %group): %user = shell/bin/shhome/home/httpd/test7uid504realtest7gid504pass$1$85678922$2XoiZBuEZP.uSqRpjCRuP/usertest7 %group = gid504grouptest7 (Correct?) But I don't think it is being passed to the foreign_call to create_user and create_group. All is get in my passwd and group files is this: :x::::: and :x:: I've tried all three of the following with no luck: &foreign_call("useradmin", "create_user", "%user"); &foreign_call("useradmin", "create_user", "\%user"); &foreign_call("useradmin", "create_user", %user); I've found references to lots of very roundabout methods of passing a hash to a function (by converting them to arrays or a string), all of which have me confused. So will the function accept an array or a string and fit it back into being a correct hash, or should I, perhaps copy the function into my module-lib.pl? Thanks! Jamie Cameron wrote: > The hash keys that need to be in %user are : > > user - The username > pass - The encrypted password (you should call encrypt_password to generate this) > uid - The user's UID > gid - The GID of the user's primary group > real - The user's real name > home - Home directory > shell - The user's shell > > In addition, if your system supports the shadow password file you also set the following > keys if you want (if not, they will just be left empty which is the default) > > change - Days since 1st jan 1970 that password was changed > min - Days before password may be changed > max - Days after which password must be changed > warn - Days before password is to expire that user is warned > inactive- The number of days of inactivity allowed for the user > expire - Days since Jan 1, 1970 that account is disabled > > - Jamie > > - > Forwarded by the Webmin development list at web...@we... > To remove yourself from this list, go to > http://lists.sourceforge.net/lists/listinfo/webadmin-devel -- -- Joe Cooper <jo...@sw...> Affordable Web Caching Proxy Appliances http://www.swelltech.com |
From: Jamie C. <jca...@we...> - 2001-03-27 07:58:27
|
Joe Cooper wrote: > > Ok... I'm almost there. But I'm stumped now. My perl ignorance is showing. > > Is there a way for me to pass the hash to a foreign_call? > > I've confirmed that everything is correct in the hashes (%user and %group): > > %user = > shell/bin/shhome/home/httpd/test7uid504realtest7gid504pass$1$85678922$2XoiZBuEZP.uSqRpjCRuP/usertest7 > > %group = gid504grouptest7 > > (Correct?) > > But I don't think it is being passed to the foreign_call to create_user > and create_group. All is get in my passwd and group files is this: > > :x::::: > > and > > :x:: > > I've tried all three of the following with no luck: > > &foreign_call("useradmin", "create_user", "%user"); > &foreign_call("useradmin", "create_user", "\%user"); > &foreign_call("useradmin", "create_user", %user); > > I've found references to lots of very roundabout methods of passing a > hash to a function (by converting them to arrays or a string), all of > which have me confused. So will the function accept an array or a > string and fit it back into being a correct hash, or should I, perhaps > copy the function into my module-lib.pl? You just have to pass it as a reference .. like so : &foreign_call("useradmin", "create_user", \%user); I don't think there is any way to pass an actual hash to a perl function .. - Jamie |
From: Joe C. <jo...@sw...> - 2001-03-27 14:37:20
|
Fabulous. Works perfectly now. Fun times. On to adding a Webmin user, and DNS and Sendmail entries. I might just finish this thing after all (I'm even doing access controls this time). As always, thanks a lot, Jamie. Jamie Cameron wrote: > Joe Cooper wrote: > >> Ok... I'm almost there. But I'm stumped now. My perl ignorance is showing. >> >> Is there a way for me to pass the hash to a foreign_call? > > You just have to pass it as a reference .. like so : > > &foreign_call("useradmin", "create_user", \%user); > > I don't think there is any way to pass an actual hash to a perl function .. > > - Jamie -- Joe Cooper <jo...@sw...> Affordable Web Caching Proxy Appliances http://www.swelltech.com |