From c81b7f986867db292d62a1757123723b5ef66518 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Wed, 12 Dec 2001 19:52:40 +0000 Subject: Initial revision --- volinit-samba | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 volinit-samba (limited to 'volinit-samba') diff --git a/volinit-samba b/volinit-samba new file mode 100755 index 0000000..d33ad00 --- /dev/null +++ b/volinit-samba @@ -0,0 +1,59 @@ +#!/bin/bash + +[ -f /etc/local/volumes ] || exit 1 +. /etc/local/volumes +[ "x$SDIR" = "x" ] && exit 1 + +if [ $# -eq 0 ]; then +# echo "$0: directory name(s) required" + echo "Usage: $0 [create]" + exit 1 + fi + +if [ "x$1" = "x" ]; then + echo "$0: base directory missing" + exit 1 + fi +VOL=$SDIR/$1 + +if [ "x$2" = "x" ]; then + echo "$0: read group missing" + exit 1 + fi +ALL=$2 + +if [ "x$3" = "x" ]; then + echo "$0: write group missing" + exit 1 + fi +GRP=$3 + +#GRPUSER="nobody" +GRPUSER="admin" +#if [ "x$4" != "x" ]; then +# GRPUSER=$4 +#else + id $GRP >/dev/null && GRPUSER=$GRP +#fi + +if [ "x$4" != "x" ]; then + if [ "x$4" == "xcreate" ]; then + mkdir -p $VOL/$ALL/$GRP || exit + else + echo "Usage: $0 [create]" + exit 1 + fi +fi + +test -d $VOL/$ALL/$GRP || exit +chown root.$ALL $VOL/$ALL +chown $GRPUSER.$ALL $VOL/$ALL/$GRP +chmod u=rwX,g=rX,o= $VOL/$ALL +chmod u=rwX,g=rX,o= $VOL/$ALL/$GRP +echo "People in group $GRP has read/write access through SMB networking" +test $GRP = $ALL || echo "People in group $ALL has read access through SMB networking" +echo "Others have no access" +echo -n "Checking permissions..." +chown -R $GRPUSER.$GRP $VOL/$ALL/$GRP \ + && chmod -R u=rwX,g=rwX,o=rX $VOL/$ALL/$GRP +echo "." -- cgit v1.2.3