Kiosk shell scripts are a bunch of shell scripts to create a very simple Internet kiosk with prepaid accounts.
Scenario:
The user has private username/password and private home-directory.
The user buys credits, ie. amounts of minutes to use the account. Every minute the account is in use, one unit is deducted from his/her account.
When the credit reaches zero (or the grace value, respectively), he/she is foribly logged out and the account is blocked.
If an account is not accessed for a certain amount of days, the account and the home-folde is deleted.
The account can be reactivated by the administrator.
This scrips do not set or lock any configurations on the screen (use other programs for that).
kiosk.showcredit.sh shows the credits of the current in a xmessage box.
This scripts is for the user to let him/her check his/her credits. It should be accessible via a button on the menu bar and clearly visible, so that the customer can check his balance.
kiosk.message.sh shows a warning message on the screen of the user at certain intervals. The intervals are set in the arrys 'WARN[]' in kiosk.conf. The script loops throught all the warn[] array. The arrray MESSAGE[] contains the corresponding message for the warn interval.
This script has to be autostarted by the user.
For KDE use:
place link to script or script in Autostart folder (~/.kde/Autostart)
see 'HOWTO Autostart Programs' (http://gentoo-wiki.com/HOWTO_Autostart_Programs) how to autostart programs.
It is advisable to create the entry in /etc/skel directory so that every newly created user will receice the file in place.
kiosk.minus.sh deducts one unit of credit from all users that are currently logged in by adding -1 to their credit files.
If a user's credit reaches the grace time set in $GRACE, his/her session is terminated, first by trying to kill any 'session' (like gdm.session') and then by pkill everything. The user's password is blocked to avoid new loggin by the user. To unlock the password use 'sudo passwd <user> -u'.
The script should be run by crontab every minute (or whatever time unit you choose), so that the credits are deducted automatically.
Entry for crontab (root)
1 * * * * /usr/local/bin/kiosk.minus.sh
kiosk.delete.account.sh deletes a user account that did not log in for the amount of days set in $DAYS. Users that never logged in are skipped. After deleting an account, it creates an entry in the logfile ($LOGFILE).
kiosk.delete.account.sh should be run not more than once a day by crontab or as startup script (rc.local)
Entry for crontab (root)
0 0 * * * /usr/local/bin/kiosk.minus.sh
kiosk.manage_account.sh manages various user account settings. If no user is given as argument, a chooser lets you select a user.
It prints some user information and prompts for one of the following actions:
1) add_credits 3) set_passwd 5) exit
2) lock_passwd 4) unlock_passwd
1) add_credits
The credits entered are added to the user's credit file.
To directly manage credits, the files in $KIOSKDIR/<username> can be edited.
2) lock_passwd
Locks the password. User can't login anymore
3) set_passwd
Sets a new password.
4) unlock_passwd
Unlocks the password. Needed when the user was forcibly logged out.
5) exit
Quit script
kiosk.manage_account.sh has to run as root.
kiosk.sum.sh outputs the current amount of credit of a given user
copy all scripts to /usr/local/bin/
copy kiosk.conf to /etc/.
create a kiosk-directory
mkdir /var/kiosk
Kiosk shell scripts use private user accounts for each customer. Instead of creating the accounts when a new customers arrives in thec cafe, all accounts can be created once. The customer's home directory is just created when he/she logs in for the first time. This saves space on the /home partition.
* Create an ascii file with username password pairs plus credit (one line each), eg.
freddy mypasswd 250
This line will add a user 'freddy' with password 'mypasswd' and give him 250 minutes of credit.
Use kiosk.create_users.sh <file>
* Add this line to /etc/pam.d/login (not the end!)
session required pam_mkhomedir.so skel=/etc/skel/ umask=0022
See pam for more information
PAM will create a home directory just before the user logs in for the first time.
Print the username, password, credit information on small pieces of paper. Store them safely and sell each of them to your customer.