Koozali.org: home of the SME Server

add-user script on SME 5.6

Craig Jensen

add-user script on SME 5.6
« on: March 18, 2003, 09:36:08 AM »
The adduser script mentioned here...

http://mirror.contribs.org/smeserver/contribs/dmay/mitel/howto/addusers-howto.html

used on SME 5.6 produces errors which indicate:
PaswordSet command not found from this portion of the code below

# ---------------------------------
# Set value for password as created
# ---------------------------------
/sbin/e-smith/db accounts setprop $username PasswordSet yes


What would be the appropriate change in this to allow for multi-user creation on SME 5.6 correctly?

Thank you

Craig

stephen noble

Re: add-user script on SME 5.6
« Reply #1 on: March 18, 2003, 12:36:39 PM »
/sbin/e-smith/db accounts setprop $username PasswordSet yes

should work,
this is only making the value PaswordSet = yes for a user
the db command hasn't changed since 4.0

i though techgeeks had a later adduser function
i'd try there

Scott Smith

Re: add-user script on SME 5.6
« Reply #2 on: March 18, 2003, 04:56:59 PM »
The problem is most like the value of $username. Since it is an unquoted variable, the shell will interpret special characters. This can cause problems. For example, if the last character of the username happens to be a semi-colon (;) that is the command separator for most shells and it would see PasswordSet as the name of a new command. There are other characters than could cause problems, too.

In shell scripts, you should almost always quote the use of variables in order to hide/protect special characters, especially in situations like this where it is a simple value substitution. Change the command line to:

/sbin/e-smith/db accounts setprop "$username" PasswordSet yes

and your problem will likely disappear.

Craig Jensen

Re: add-user script on SME 5.6
« Reply #3 on: March 18, 2003, 05:18:29 PM »
Thanks for the reply Stephen/Scott.

After making the suggested change to the command, here is the output:

-----------------------------------------------------------snip---------------------------------------
[root@sme-test root]# ./e-smith-adduser.sh
users: too many arguments
Try users --help' for more information.
./e-smith-adduser.sh: PasswordSet: command not found
Failed to set Unix password for account jbach: User not known to the underlying authentication module
User jbach does not exist in system password file (usually /etc/passwd). Cannot add account without a valid local system user.
Failed to modify password entry for user jbach
Failed to set Samba password for account jbach.
Child exited early. at /usr/lib/perl5/site_perl/esmith/util.pm line 908.
-----------------------------------------------------------snip---------------------------------------

Which repeats with each user creation.

The user 'jbach', when viewed in server-manager user accounts shows as having a password set.  Yet, when I attempt to login it fails and when I click to reset the password the panel returns an empty whit screen with no changes... yet, the user whose account was created just as I aborted the script shows with a 'reset password' in red and account locked.  So, the issue is with the password creation portion of the account creation in the script... which we already knew.  I am hoping the shippett above will provide a clue for you or someone familiar with the account creation in SME 5.6.

Thanks again.

Craig

Abe Loveless

Re: add-user script on SME 5.6
« Reply #4 on: March 19, 2003, 07:55:51 PM »
Try this one instead:

http://www.tech-geeks.org/contrib/loveless/batch_users/

I installed about 100 users last week on a 5.6 server without any trouble.

Craig Jensen

Re: add-user script on SME 5.6
« Reply #5 on: March 20, 2003, 11:08:14 PM »
thank youu Abe.  That is a wonderful script.

I don't 'yet' have quite enough perl experience to write such a thing.

Thanks again

Craig