root/alternc/tags/0.9.6/src/fixperms.sh

Revision 1646, 2.1 kB (checked in by benjamin, 3 years ago)

Ajout du script fixperms.sh qui permet de remettre à plat les permissions et proprietaires des fichiers. Ref #416

  • Property svn:executable set to *
Line 
1 #!/bin/sh -e
2
3 #
4 # $Id: fixperms.sh,v 1.1 2005/08/29 19:21:31 benjamin Exp $
5 # ----------------------------------------------------------------------
6 # AlternC - Web Hosting System
7 # Copyright (C) 2002 by the AlternC Development Team.
8 # http://alternc.org/
9 # ----------------------------------------------------------------------
10 # Based on:
11 # Valentin Lacambre's web hosting softwares: http://altern.org/
12 # ----------------------------------------------------------------------
13 # LICENSE
14 #
15 # This program is free software; you can redistribute it and/or
16 # modify it under the terms of the GNU General Public License (GPL)
17 # as published by the Free Software Foundation; either version 2
18 # of the License, or (at your option) any later version.
19 #
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 # GNU General Public License for more details.
24 #
25 # To read the license please visit http://www.gnu.org/copyleft/gpl.html
26 # ----------------------------------------------------------------------
27 # Original Author of file: Benjamin Sonntag for Metaconsult
28 # Purpose of file: Fix permission and ownership of html files
29 # ----------------------------------------------------------------------
30 #
31
32 CONFIG_FILE="/etc/alternc/local.sh"
33
34 PATH=/sbin:/bin:/usr/sbin:/usr/bin
35
36 umask 022
37
38 if [ ! -r "$CONFIG_FILE" ]; then
39     echo "Can't access $CONFIG_FILE."
40     exit 1
41 fi
42
43 if [ `id -u` -ne 0 ]; then
44     echo "fixperms.sh must be launched as root"
45     exit 1
46 fi
47
48 . "$CONFIG_FILE"
49
50 function doone {
51     read GID LOGIN
52     while [ "$LOGIN" ]
53       do
54       if [ "$DEBUG" ]; then
55           echo "Setting rights and ownership for user $LOGIN having gid $GID"
56       fi
57       INITIALE=`echo $LOGIN |cut -c1`
58       REP="$ALTERNC_LOC/html/$INITIALE/$LOGIN"
59            
60       find $REP -type d -exec chmod g+s \{\} \;
61           chown -R 33.$GID $REP
62           read GID LOGIN
63     done
64 }
65
66 mysql -h"$MYSQL_HOST" -p"$MYSQL_PASS" -u"$MYSQL_USER" "$MYSQL_DATABASE" -B -e "select uid,login from membres" |grep -v ^uid|doone
67
Note: See TracBrowser for help on using the browser.