diff options
Diffstat (limited to 'useradd.sh')
-rwxr-xr-x | useradd.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/useradd.sh b/useradd.sh new file mode 100755 index 0000000..252c092 --- /dev/null +++ b/useradd.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +if [[ $1 == "" || $2 == "" ]];then + read -p"username: " username + read -p"password: " password + read -p"retap password: " password2 + while [[ $password != $password2 || $password == "" ]] + do + echo "mismatch passord" + read -p"password: " password + read -p"retap password: " password2 + done +else + username=$1 + password=$2 +fi + +if [[ $username != "root" ]]; then + mkdir -p "build/airootfs/home/$username" +fi +echo $username":"$(mkpasswd -m sha-512 -S spaceunicorne -s <<< $password)":17076:0:99999:7:::" >> build/airootfs/etc/shadow |