fix bugs in makeuser

This commit is contained in:
fosslinux 2019-03-01 22:53:36 +00:00
parent ba4f9cb87e
commit 96c1c11108
2 changed files with 6 additions and 1 deletions

Binary file not shown.

View File

@ -2,6 +2,11 @@
pw=$(pwgen -1B 10)
pwcrypt=$(perl -e "print crypt('${pw}', 'sa');")
useradd -m -g 100 -p ${pwcrypt} -s /bin/bash $1 || exit 1
mkdir /home/$1/.ssh
touch /home/$1/.ssh/authorized_keys
chown -R $1:tilde /home/$1
chmod 700 /home/$1/.ssh
chmod 600 /home/$1/.ssh/authorized_keys
echo "$3" | tee /home/$1/.ssh/authorized_keys
sed -e "s/USERNAME/$1/g" -e "s/PASSWORD/${pw}" /var/aussie/emails/email.tmpl | sendmail $1@aussies.space $2 fosslinux@aussies.space
sed -e "s/USERNAME/$1/g" -e "s/PASSWORD/${pw}/g" /var/aussie/emails/signup.tmpl | sendmail $1@aussies.space $2 fosslinux@aussies.space