Created
January 31, 2024 11:57
-
-
Save JonasGao/bc74af198e2c926d04dde7e956a57601 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
[ -z "$1" ] && echo "Please provide a password" && exit 1 | |
[ "${#1}" -lt 8 ] && echo "Password length must greater then 8" && exit 2 | |
ADD_USER="<Please replace here>" | |
echo "Adding user $ADD_USER" | |
useradd $ADD_USER | |
echo "Succeed add user $ADD_USER" | |
echo -e "$1\n$1\n" | passwd --stdin $ADD_USER | |
echo "Changed $ADD_USER password" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment