metash - shell independant configuration files
----------------------------------------------

Unix gives the user the freedom to choose between different shells.
The mourner of it is the system administrator: if for example the
PATH-variable should be expanded to include /opt/bin, he has to

    (1) remember the name of the configuration-files of all shells
    (2) know the syntax of their files
    (3) change every individual file by hand.

There is already a software available which allows setting of
resource-limit in a shell-independant manner. It's name is "lshell".
Now, the idea behind it can be expanded at least to environment variables,
the umask and other facilities which are inherited automatically to child
processes (are there any left?).

To demonstrate the extension, I've written a small sh-script to source in
central configuration files just before the shell of the user is
started. E.g. you could set the environment variable PRINTER or LANG this
way for all your shells in /etc/meta/environment

        case $GROUPID in
          20900) PRINTER=declaser ;;
          21000) PRINTER=klaser   ;;
          32128) PRINTER=katalog  ;;
          20970) PRINTER=lj4m     ;;
          20950) PRINTER=declaser ;;
        esac

The features of "lshell" are implemented by "metash", too. But,
it uses this table in /etc/meta/limits instead of a somewhat cryptic
configuration-string:

        #       who         cpu_time  memory  jobs    files
        user    truemper        3600   24000    64        -
        uid     1000-2000        900   16000    64        -
        user    *                900    8000    32       32

It could be extended for other resource-limits, but I'm just to lazy.
The reason for release is the fact that I can't invest any time into
it's development in the foreseeable future.

Since version 0.3 you can set the umask the same way as above in
/etc/meta/umask

        #       who         	create mode for new files/directories
        user    truemper	rwx------
        uid     1000-2000       rwxr-x---
        user    *               rwxrwxr-x

Playing with metash should be fairly safe as long as you use an extra
account for that. To install metash:

	cp metash /bin
	chmod 755 /bin/metash
	cd /bin
	mkdir meta
	cd meta
	while read SHELL
	do
		if [ -x "$SHELL" ]
		then
			SHELL=${SHELL#*/}
			ln -s ../metash $SHELL
		esac
	done < /etc/shells


Now, if you use "/bin/meta/bash" as login-shell for a user, the link will
be followed on login and "/bin/metash" will be executed. Inside the script
the variable name $0 contains the name of the link and "meta/" will be cut
from it, leaving "/bin/bash". This core functinallity is achvied with the
last lines of code:

	  # source in environment variables
	set -a
	if [ -f "/etc/meta/environment" ]
	then
	        source /etc/meta/environment
	fi
	set +a
[..]
	if [ -x "$SHELL_BIN" ]
	then
	    exec $SHELL_BIN $ORGARGS
	fi
	exit 1


Everything before that implements the limitation of the resources.
For further discussion, there is a mailinglist "metash@shop.de".
Subscription is done with

	echo "subscribe" | mail metash-request@shop.de

The archive is available via http://www.shop.de/linux/archives/metash/


Regards
-Winfried