#!/bin/sh # ############################################# # Helperscript for samba # ====================== # Create userspecific directory-entrys (as symbolic links) # at a specified networkshare or directory like the # novellstyle to show only dirs to there the user has the # correct rights (minimum are read-right) #------------------------------------------- # Hilfsskript für Samba # ===================== # Erzeugen von Userspezifischen Links in einem # Verzeichnis/Netzwerkshare (nur die Verzeichnisse "linken", # die eine solche Gruppenzugehörigkeit haben, wie der # entsprechende Benutzer auch Leserechte hat) # ##### # Author: Heiko Teichmeier, Glauchau/Sa. # Date: 03.08.2004 # Mail: heiko@tei-lin-net.de # Web: www.tei-lin-net.de ##### # # Original-Tip von http://www.meyer-edv.de # ##### # Here you may configure as you need it #------------------------------------------- # Hier an eigene Bedürfnisse anpassen LINK_DIR="/win_home/dir-links" ROOT_DIR_1="/win_home/daten" # with arg1($1) get the script the username #------------------------------------------- # Dem Skript wird mit Argument1($1) der Anmeldename übergeben USER_N="$1" umask 022 cd $LINK_DIR rm -rf $USER_N mkdir $USER_N chown $USER_N:$USER_Nl $USER_N cd $USER_N for gr in `groups $USER_N | cut -f2 -d":"` do # list all dirs with the group "$gr" #--------------------------------------- # Liste alle Verzeichnisse mit dem Gruppennamen "$gr" auf filelist=`find $ROOT_DIR_1 -group $gr -type d -maxdepth 1` for file in $filelist do if test $file != "$ROOT_DIR_1" # if it's not the "$ROOT_DIR_1", then ... #----------------------------------------------------- # Wenn die Datei nicht das angeg. Root-Dir ist, dann ... then # create a symbolic link to it (at the actual dir) #----------------------------------------------------- # erzeuge einen symbolischen Link (im aktuellen Verzeichnis) ln -s $file # use follow option if you want to set the group-identity of # the link to the original group-identity (or what you want # with this script) #----------------------------------------------------- # folgende Option verwenden, wenn Gruppenzugehörigkeit # an Original-Verzeichnis angepaßt werden muss #chgrp $gr `basename $file` fi done done