Amélioration des traitements possible de fixperms (report r3121)
* -l login du compte concerné (/var/alternc/html/l/login) * -u uid (gid unix associé au compte concerné) * -d sous_repertoire (/var/alternc/html/l/login/sous_repertoire) * sous_repertoire est un chemin relatif de profondeur n * Les droits seront corrigés pour l'ensemble des sous repertoires repondant à la contrainte : /var/alternc/html/l/login/sous_repertoire Il n'est pas neccessaire d'utiliser -l ou -u Le comportement initial est conservé * si pas d'arguments alors on fixe les droits de l'ensemble de /var/alternc/html * si on fournit un autre parametre on annule le traitement avec message d'erreur
This commit is contained in:
parent
f5d4dc84fd
commit
363682991e
|
@ -29,6 +29,41 @@
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
|
||||||
|
#Default Query : fixperms for all account
|
||||||
|
query="SELECT uid,login FROM membres"
|
||||||
|
sub_dir=""
|
||||||
|
|
||||||
|
#Two optionals argument
|
||||||
|
# -l string : a specific login to fix
|
||||||
|
# -u interger : a specifi uid to fix
|
||||||
|
while getopts "l:u:d:" optname
|
||||||
|
do
|
||||||
|
case "$optname" in
|
||||||
|
"l")
|
||||||
|
query="SELECT uid,login FROM membres WHERE login LIKE '$OPTARG'"
|
||||||
|
;;
|
||||||
|
"u")
|
||||||
|
query="SELECT uid,login FROM membres WHERE uid LIKE '$OPTARG'"
|
||||||
|
;;
|
||||||
|
"d")
|
||||||
|
sub_dir="$OPTARG"
|
||||||
|
;;
|
||||||
|
"?")
|
||||||
|
echo "Unknown option $OPTARG - stop processing"
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
":")
|
||||||
|
echo "No argument value for option $OPTARG - stop processing"
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Should not occur
|
||||||
|
echo "Unknown error while processing options"
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
CONFIG_FILE="/etc/alternc/local.sh"
|
CONFIG_FILE="/etc/alternc/local.sh"
|
||||||
|
|
||||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
|
@ -55,7 +90,7 @@ doone() {
|
||||||
echo "Setting rights and ownership for user $LOGIN having gid $GID"
|
echo "Setting rights and ownership for user $LOGIN having gid $GID"
|
||||||
fi
|
fi
|
||||||
INITIALE=`echo $LOGIN |cut -c1`
|
INITIALE=`echo $LOGIN |cut -c1`
|
||||||
REP="$ALTERNC_LOC/html/$INITIALE/$LOGIN"
|
REP="$ALTERNC_LOC/html/$INITIALE/$LOGIN/$sub_dir"
|
||||||
|
|
||||||
find $REP -type d -exec chmod g+s \{\} \;
|
find $REP -type d -exec chmod g+s \{\} \;
|
||||||
chown -R 33.$GID $REP
|
chown -R 33.$GID $REP
|
||||||
|
@ -63,5 +98,5 @@ doone() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
mysql --defaults-file=/etc/alternc/my.cnf -B -e "select uid,login from membres" |grep -v ^uid|doone
|
mysql --defaults-file=/etc/alternc/my.cnf -B -e "$query" |grep -v ^uid|doone
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue