Koozali.org: home of the SME Server

Legacy Forums => General Discussion (Legacy) => Topic started by: Soren on November 25, 2002, 01:20:09 AM

Title: Adding new user from the shell
Post by: Soren on November 25, 2002, 01:20:09 AM
I want to add a new user, just like the ones I can create in the server-manager - but I want to do it from the shell.

How do I do that?
Title: Re: Adding new user from the shell
Post by: Bob Todd on November 25, 2002, 02:58:40 AM
use the command "adduser"
Title: Re: Adding new user from the shell
Post by: Soren on November 25, 2002, 02:16:20 PM
Bob Todd: Are you sure that will add the user just as if he was addes using the server manager with mail account, home dir etc?
Title: Re: Adding new user from the shell
Post by: Jeroen on November 25, 2002, 06:30:22 PM
Adduser will only add a unix user.

Jeroen
Title: Re: Adding new user from the shell
Post by: Soren on November 26, 2002, 03:09:54 PM
Alright then. How do I create a new e-mail account from the shell?
Title: Re: Adding new user from the shell
Post by: guestHH on November 26, 2002, 05:37:35 PM
Hi,

Please note that the Mitel SME server has it's own mechnism to create and manage user accounts. If you do this on your own e.g. the 'linux' way on the console, you'll miss important features for this account and might even break correct system-updates/upgrades.

If you would like to use the console (or lack a browser), i think the easiest way would be logging in as admin and start the lynx based server manager via the console menu.

Regards,
guestHH
Title: Re: Adding new user from the shell
Post by: Soren on November 26, 2002, 06:03:50 PM
RequestedDeletion: I want to be able to create a new user account from a php page, and I thereby thought an easy way could be to use the php funcktion, that can call shell commands.
Therefore I need to be able to create a useraccount/mail account from the shell

Other suggestions?
Title: Re: Adding new user from the shell
Post by: Charlie Brady on November 26, 2002, 06:34:00 PM
Soren wrote:
>
> RequestedDeletion: I want to be able to create a new user account
> from a php page, and I thereby thought an easy way could be
> to use the php funcktion, that can call shell commands.
> Therefore I need to be able to create a useraccount/mail
> account from the shell

PHP doesn't run as root, so cannot create useraccounts.

My suggestion - give up and use the web interface which already exists.

Charlie
Title: Re: Adding new user from the shell
Post by: Dan Brown on November 26, 2002, 06:38:08 PM
...and if you're dead set on doing it from the shell, Darrell May has a script which will do the job.
Title: Re: Adding new user from the shell
Post by: Soren on November 26, 2002, 06:46:58 PM
Dan Brown:
That sounds interesting, But who's Darrell and do you think I could have a look at his script?

Charlie. I might just write a little C program that runs as root and let the program take care of the shell calls. I guess...

I appreciate all you comments and ideas :o)

Regards Soren
Title: Re: Adding new user from the shell
Post by: Dan Brown on November 26, 2002, 06:55:31 PM
Darrell's script (along with a HOWTO) can be viewed at

http://myezserver.com/downloads/mitel/howto/addusers-howto.html

It's designed for adding multiple users at a time, but could probably be tweaked to do a single user.

Another script can be found in this thread:
http://forums.contribs.org/index.php?topic=13588.msg51588#msg51588

Again, intended for multiple users, but should do the trick.
Title: Re: Adding new user from the shell
Post by: Soren on November 29, 2002, 12:23:43 PM
Great. I'm almost there. I'm using bits of Darrell's script. Just one question... I see the script is using a random number as Uid and Gid.
What happens if an exsiting Uid = the random number?. I guess an error will occur and the user will not be created. Is there an alternative method to generate a Uid/Gid that doesn't exist in the system?

/Soren