Created
June 1, 2015 13:54
-
-
Save volure/46bab8c3806634f32ff2 to your computer and use it in GitHub Desktop.
SSH: Create new email user with linked mail folder
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/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