Last active
September 28, 2023 17:15
-
-
Save iTeeLion/ecc7e3b31577f87828f86306deb3cc05 to your computer and use it in GitHub Desktop.
gameap user permissions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Add user for gameap (raplace USERNAME with yours) | |
# | |
# useradd -m -U -G gap -s /bin/bash -d /srv/gameap/USERNAME USERNAME | |
# apt install members | |
PKG=members | |
PKG_STATUS="$(dpkg-query -W --showformat='${db:Status-Status}' "$PKG" 2>&1)" | |
if [ ! $? = 0 ] || [ ! "$PKG_STATUS" = installed ]; then | |
sudo apt install $PKG | |
fi | |
# create group for gap users | |
if grep -q gap /etc/group | |
then | |
echo "Group "gap" exists." | |
else | |
echo "Group gap does not exist, creating..." | |
groupadd gap | |
fi | |
# set permissions | |
USERS=$(members gap) | |
GAPDIR="/srv/gameap" | |
cd $GAPDIR | |
for USER in $USERS | |
do | |
if [ -d "$GAPDIR/$USER" ] | |
then | |
chown -R $USER:$USER ./$USER | |
chmod -R 0770 ./$USER | |
echo "Set permissions for: $USER" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment