Skip to content

Instantly share code, notes, and snippets.

@EJSohn
Created October 10, 2018 12:25
Show Gist options
  • Select an option

  • Save EJSohn/7461d750426b360e57fdcc881d9d9e22 to your computer and use it in GitHub Desktop.

Select an option

Save EJSohn/7461d750426b360e57fdcc881d9d9e22 to your computer and use it in GitHub Desktop.
bash script that add user in ubuntu
echo "Need root permission."
sudo echo "Done."
read -p "1. Enter username: " username
read -p "2. Enter comment: " comment
sudo adduser $username -c "$comment" --firstuid 10000 --ingroup developers --disabled-password --gecos ""
echo "User created!"
echo -e "$username\n$username" | sudo passwd $username >/dev/null 2>&1
sudo passwd -e $username >/dev/null 2>&1
echo "username : $username"
echo "initial password : $username"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment