small_server_thingies/create_sudo_user.sh

11 lines
337 B
Bash
Raw Permalink Normal View History

2021-11-07 09:01:50 +01:00
# Pass an argument with the username and that will be created and added to the sudo group
no_argument_was_passed=false; [ -z "$1" ] && no_argument_was_passed=true
$no_argument_was_passed && echo "No username has been passed" && return
USERNAME=$1
echo "Creating user $USERNAME"
adduser $USERNAME
usermod -aG sudo $USERNAME
echo "Done"