Skip to content

Instantly share code, notes, and snippets.



Last active Apr 14, 2020
What would you like to do?
Add user with cusmoized useradd command
[[ $USER = "" ]] && echo 'Please set a user name' && exit;
useradd -s /bin/bash ${USER}
[[ $? -ne 0 ]] && echo 'You should have root permission!' && exit;
mkdir /home/${USER}
chown -R ${USER}:${USER} /home/${USER}
echo "Creating ${USER} has been done..."
echo "Don't forget to use passwd to set password for ${USER}!"
printf "\n"
echo "Add User to sudo group......"
gpasswd -a ${USER} sudo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment