security/adduser.sh
2024-03-21 23:20:24 +03:00

17 lines
342 B
Bash
Executable File

#!/bin/bash
if [ -z "$1" ]; then
echo "please specify a username"
exit 1
fi
password=$(echo $RANDOM$RANDOM$RANDOM | md5sum | awk '{print $1}')
echo "Username: $1"
echo "Password: $password"
password=$(echo -n $password | sha256sum | awk '{print $1}')
sqlite3 db/data.db << EOF
INSERT INTO users VALUES ('$1','$password','notset')
EOF