Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save volure/46bab8c3806634f32ff2 to your computer and use it in GitHub Desktop.
Save volure/46bab8c3806634f32ff2 to your computer and use it in GitHub Desktop.
SSH: Create new email user with linked mail folder
#!/bin/sh
whoami=`whoami`
if [ $whoami == 'root' ]; then
echo "Generating New Email User"
useradd -G emailusers $1
echo "Creating Directory in Share"
mkdir -p /space/home/$1/Maildir
echo "Setting ownership to $1:$1"
chown -R $1:$1 /space/home/$1
echo "Linking Share Maildir to Home"
ln -s /space/home/$1/Maildir /home/$1
echo "Altering User Password"
passwd $1
else
echo "Script must be run as root";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment