#!/bin/bash

echo "Enter a directory."
read directory

sudo chown -R ituser:www-data $directory
sudo find $directory -type f -exec chmod 644 {} \;
sudo find $directory -type d -exec chmod 755 {} \;
#sudo chmod -R g+s $directory

cd $directory
sudo chgrp -R www-data bootstrap/cache
sudo chgrp -R www-data storage
sudo chmod -R ug+rwx bootstrap/cache
sudo chmod -R ug+rwx storage

echo "Permissions are set in $directory"
