Views
How can different logins environments be created for different users, grouped according to classroom or grade?
Example:
The first grade teacher want his students to only use one application, a simple word processor, during their computer lab class. They are going to practice typing some vocabulary words. So the teacher wants to "give" each student a copy of the practice words, with spaces between where they can retype the words. How would you set up a configuration that would simplify this situation, so an inexperienced sysadmin could manage it, perhaps through a GUI?
First, forget the GUI. A good, solid, working command-line solution can be wrapped with Tcl/Tk or a similiar tool to provide a GUI. So don't worry about it until it's needed.
Second, is this a single Linux machine, or a bunch of Linux machines all networked together? The administration of a collection of machines is slightly more complicated than the administration of a single machine.
Third, are we assuming that the instructor has administrative access to this (these) machine(s), or is the inexperienced SysAdmin? not the instructor?
The problem as stated consists of two parts:
- Run a single application
- Distribution of data file for application
Running a single application is fairly simple - with several choices. The simplest solution is to add the application to /etc/shells, and to set each student's account to use the application as a shell. Note that some applications provide a means of shelling out, so steps should be taken if this is a problem.
Another solution is to run the application in the startup-scripts for the user (e.g. ".login" for csh). This might be necessary if you need to set up the environment and cannot do so for the system as a whole.
Distributing the data-file is just a matter of creating and maintaining a list of accounts/directories for each "class". Then a simple script can copy the appropriate file to each student's home directory (or make a symbolic link).
For example, assume that all students are logging into a central machine, and that each class has a file named class##.dirs that contains the home directories for each student in that class, one per line. Then the following script might be useful (call it "foo"):
#!/bin/sh
#
# Distribute file to list of
# directories on local system
#
if [[ $# -lt 2 ] ; then
echo "Usage $0 listfile distfile"
exit 1
fi
for i in `cat $1` do
echo "Copying $2 to $i/$2"
cp $2 $i/$2
done
To distribute a datafile, the instructor would simply type:
foo class09.dirs samplefile.text
And the script would copy samplefile.text to each of the directories listed in the class09.dirs file.
Note that this same script can be used to distribute .login files to each account quite easily, allowing the instructor to change applications based on the class/lab.