| 3 | | Only MFPL admins have permission to take this step. If you would like suExec enabled for your site, please follow our [wiki:suexec suExec FAQ]. |
| 4 | | |
| 5 | | Run the following script, passing the name of the user as the first argument to the script. |
| 6 | | |
| 7 | | {{{ |
| 8 | | #!/bin/bash |
| 9 | | # Script to create cgi-bin directory for /var/www/members-cgi-in |
| 10 | | |
| 11 | | base=/var/www/members-cgi-bin |
| 12 | | |
| 13 | | if [ -z "$1" ]; then |
| 14 | | echo "Please pass the user to create the cgi directory for." |
| 15 | | exit |
| 16 | | fi |
| 17 | | |
| 18 | | user="$1" |
| 19 | | |
| 20 | | sitepath=$(getent passwd "$user" | cut -d: -f6 | cut -d/ -f1-6) |
| 21 | | site=$(echo "$sitepath" | cut -d/ -f6) |
| 22 | | group=$(echo "$sitepath" | cut -d/ -f4) |
| 23 | | |
| 24 | | if [ -z "$sitepath" ]; then |
| 25 | | echo "The user '$user' does not seem to exist" |
| 26 | | exit |
| 27 | | fi |
| 28 | | |
| 29 | | # Build directories |
| 30 | | |
| 31 | | if [ ! -d "$base" ]; then mkdir "$base"; fi |
| 32 | | |
| 33 | | if [ ! -d "$base/$site" ]; then |
| 34 | | echo "Creating '$base/$site'" |
| 35 | | mv "$sitepath/cgi-bin" "$base/$site" |
| 36 | | chown "$user:$group" "$base/$site" |
| 37 | | ln -s "$base/$site" "$sitepath/cgi-bin" |
| 38 | | fi |
| 39 | | |
| 40 | | # Ensure suexec is enabled (reload apache if necessary) |
| 41 | | if [ ! -h /etc/apache2/mods-enabled/suexec.load ]; then |
| 42 | | echo "suexec not enabled, enabling and reloading apache" |
| 43 | | /usr/sbin/a2enmod suexec |
| 44 | | /etc/init.d/apache2 reload |
| 45 | | fi |
| 46 | | }}} |
| 47 | | |
| | 3 | Suexec is now enabled by default for all members. |