Hello i want to automate setting up users on my servers. So i started with this simple bash
#! /bin/bash
if [ $# -ne 2 ]
then
echo "Usage: $(basename $0) USERNAME PASSWORD"
exit 1
fi
user_name=$1
password_var=$2
exec useradd -m $user_name
usermod -s /bin/bash
#echo "$2" | exec chpasswd $user_name --stdin
usermod -aG www-data "${user_name}"
I have a problem with the last line. The user i just created does not get assigned to the group www-data. When i use only the last line and comment everthing else and feed my one user into the script i am able to add myself, can someone explain me why this is faling?
execnever returns