add user bash code example
Example 1: how to make new user linux termil
sudo useradd -m username
#set user password
sudo passwd username
#add user to sudoers [DANGEROUS]
usermod -aG sudo username
Example 2: how to add user from bash in mac
dscl . -create /Users/joeadmin
dscl . -create /Users/joeadmin UserShell /bin/bash
dscl . -create /Users/joeadmin RealName "Joe Admin"
dscl . -create /Users/joeadmin UniqueID "510"
dscl . -create /Users/joeadmin PrimaryGroupID 20
dscl . -create /Users/joeadmin NFSHomeDirectory /Users/joeadmin
dscl . -passwd /Users/joeadmin password
dscl . -append /Groups/admin GroupMembership joeadmin
Example 3: create user in linux
useradd [OPTIONS] USERNAME