Created
October 10, 2018 16:46
-
-
Save duven87/678f18a56867f648cba2df7aa33664b9 to your computer and use it in GitHub Desktop.
mkuser
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 | |
# | |
# Create account user and pass | |
################################ | |
#Obtain valor variable | |
####################### | |
while [ "$Username" != "Exit" ] | |
echo | |
echo -e "Please enter username for account or type Exit: \c" | |
read Username | |
do | |
# Create account of user ### | |
useradd $Username | |
#Check if variable had content: | |
####################################### | |
if [ -z $Username ] | |
then | |
echo | |
echo You didnt provide a username | |
echo Leaving script.. | |
exit | |
fi | |
case $Username in | |
Exit) | |
echo Leaving script.. | |
exit | |
;; | |
*) | |
echo | |
echo Account for $Username is being created... | |
;; | |
esac | |
#Define pass for the account | |
############################# | |
echo Password for $Username is being set.. | |
echo | |
passwd $Username | |
# Show reg. of the account | |
# | |
User_Record=$(grep $Username /etc/passwd) | |
# | |
echo | |
echo here is $Username \'s record\: | |
echo $User_Record | |
echo | |
# | |
echo Account is ready for use. | |
done | |
echo Leaving script... | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment