Skip to content

Instantly share code, notes, and snippets.

@peter279k
Last active April 14, 2020 16:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peter279k/9c6c96d0fa26bee320195a7539a5de6c to your computer and use it in GitHub Desktop.
Save peter279k/9c6c96d0fa26bee320195a7539a5de6c to your computer and use it in GitHub Desktop.
Add user with cusmoized useradd command
#!/bin/bash
USER=$1
[[ $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