When we started working on a web project, we were using git for individual parts of the project but we wanted to see the projects as a web page and updating git to wait for results was a bit more difficult than expected. Because of this, we decided to create user directories on the server hosting the project which would render everything through the web server. This made testing much easier, as any scripts could be tested locally.
The user directories were creating using the following script:
user=
pass=
users=
passwords=
count=0
while [ 1 ]
do
Β Β Β # Prompt and get the username
Β Β Β echo -n “Enter username [Blank to Exit]: “
Β Β Β read user
Β Β Β if [ -z $user ]; then
Β Β Β Β Β Β break
Β Β Β fi
Β Β Β # Check for errand username formats
Β Β Β if [[ ! $user =~ ^[a-z] ]]; then
Β Β Β Β Β Β echo “Invalid username”
Β Β Β Β Β Β continue
Β Β Β fi
Β Β Β # Set up the user and directories
Β Β Β useradd $user -d $BASE_DIR/$user
Β Β Β mkdir $WEB_DIR/$user
Β Β Β chown $user:developer $WEB_DIR/$user
Β Β Β ln -s $WEB_DIR/$user $BASE_DIR/$user/html
Β Β Β chown $user:developer $BASE_DIR/$user/html
Β Β Β users[$count]=$user
Β Β Β count=$(($count + 1))
Β Β Β # Check for more users
Β Β Β echo -n “Another User? (y/N): “
Β Β Β read another
Β Β Β if [ -z $another ]; then
Β Β Β Β Β Β break
Β Β Β fi
Β Β Β if [ $another != ‘y’ ] && [ $another != ‘Y’ ] && [ $another != ‘yes’ ] && [ $another != ‘Yes’ ]
Β Β Β then
Β Β Β Β Β Β break
Β Β Β fi
done
for (( i = 0; i < $count; i++ ))
do
Β Β Β echo “Username:Β Β Β ${users[$i]}”
Β Β Β echo “${users[$i]}” >> users.csv
done
The script creates a new user given a user name and creates a home folder for that user. Then a directory is created in the development folder of the web directory with the same name as the user name. The permissions is then corrected so the correct user can edit their code. Once this is done a symlink is placed in the user’s home folder to make it a little easier. To place your code in the web directory you just needed to place your code in your own html folder.
To access an individual’s web work, you could go to cstest.worcester.edu/development/ and get a list of the user directories. You could then view the work by clicking on the correct user.

From the blog CS 401 - Object Oriented Design Β» cs-wsu by dillonmurphy10 and used with permission of the author. All other rights reserved by the author.