Skip to content

Instantly share code, notes, and snippets.

@sirLisko
Created March 11, 2013 23:31
Show Gist options
  • Save sirLisko/5138911 to your computer and use it in GitHub Desktop.
Save sirLisko/5138911 to your computer and use it in GitHub Desktop.
How to enable access for specific folder and subdomain in webfaction
#!/bin/bash
wrong_input () {
echo "Usage: sh access.sh secondary_username application [-ln]"
echo " -ln: creates an application's symbolic link in the secondary_username home folder."
exit 1;
}
if [ $# -lt 2 ]; then
wrong_input
fi
setfacl -m u:$1:--x $HOME
setfacl -m u:$1:--- $HOME/webapps/*
setfacl -R -m u:$1:rwx $HOME/webapps/$2
setfacl -R -m d:u:$1:rwx $HOME/webapps/$2
chmod g+s $HOME/webapps/$2
setfacl -R -m d:u:$USER:rwx $HOME/webapps/$2
if [ $# -gt 2 ]; then
if [ $3 = "-ln" ]; then
USER=$USER
echo "Insert secondary_username ($1) password."
su - $1 -c "ln -s /home/$USER/webapps/$2 ~/$2"
else
wrong_input
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment