[K12OSN] Re: Customised smbldap-useradd-bulk script (quite long)

Matt Oquist moquist-k12osn at majen.net
Fri Feb 4 16:42:43 UTC 2005


> From: "Brian Chivers" <brian at portsmouth-college.ac.uk>
> Subject: [K12OSN] Customised smbldap-useradd-bulk script (quite long)

> I've been looking at the smbldap-useradd-bulk script for the creation
> ofusers and it almost fits the bill except for one thing, we use a
> differenthome directories depending of what tutor group the student is in.
> So forexample we have
> 
> /home_student/tutorgroups/101/e000000
> 
> where e000000 is the students unique enrollment number.
> 
> I've altered the bulk script to read a userinfo.start file that looks like
> this
> 
>     firstname,surname,username3,513,/bin/false,/home_student/tutorgroup/,101
>     firstname,surname,username4,513,/bin/false,/home_student/tutorgroup/,101
>     firstname,surname,username5,513,/bin/false,/home_student/tutorgroup/,101
> 
> and the resulting username.finish looks like this
> 
>     #################################
>     Fri Feb 4 15:19:00 2005
> 
>     firstname,surname,username3,513,coo22gra
>     firstname,surname,username4,513,get25hoi
>     firstname,surname,username5,513,naw44not
> 
> This allows me to specify the users default shell (which is different to
> staff users) and home directory

Good idea, Brian.  I didn't think of letting folks customize their
users' home directories or shells, and the script should make those
possible -- but not required.

I think you modified the script correctly, but we should try to figure
out what the best way to handle this problem is.  That is, it would be
best to have one version of the script that is consistently updated
rather than multiple versions that need to be kept in sync, and we
need to make that One Version ("to rule them all...") work as well as
possible for as many people as possible - including folks who want to
specify alternate shells and custom home directory schemes.

I propose that we add two new fields to the input to
smbldap-useradd-bulk: "home" and "shell".

Input would look like this:
>     firstname,surname,username,[GID,shell,home-directory,password]

Note that the last four fields are [optional], and any of them can be
specified apart from the others as long as a blank is left for any
internal field.

For example, the following specifies a shell but no GID:
>     firstname,surname,username,,shell
And here, a password but no other optional field:
>     firstname,surname,username,,,,password

Output from the script would look like this:
>     firstname,surname,username3,GID,shell,home-directory,password

So for you, Brian, an example input line would look like this:
firstname,surname,username,GID,/bin/false,/home_students/tutorgroup/101/

I think this is reasonable because by the time you've got students
divided into tutoring groups, you've got to enter the data one way or
another.  If we simply add generic fields such as "home" and "shell"
to the smbldap-useradd-bulk script, you can create those home
directory paths in your input with your custom information, rather
than forcing everyone who uses smbldap-useradd-bulk to have a "tutor"
field, which almost no one else will use.

The combination of create-usernames and smbldap-useradd-bulk (and the
'make' command) will continue to work fine after these changes.

Please let me know if anyone has any objections to these changes being
made.  Assuming this works for everyone, I'll plan to make these
changes to smbldap-useradd-bulk and release another version soon --
hopefully this weekend.

Maybe we can nail the roaming profiles problem simultaneously...?

--matt




More information about the K12OSN mailing list