orabona/create_users/create_u.sh

38 lines
686 B
Bash
Raw Permalink Normal View History

2014-01-07 15:55:06 +00:00
#!/bin/bash
2020-09-18 12:35:37 +00:00
IP="192.168.230.4"
2014-01-07 15:55:06 +00:00
pass=`pwgen -N 1`
MYSQL_pass=`pwgen -N 1`
useradd -m $1
echo $1:$pass| chpasswd
echo "User created"
echo "Name: $1"
echo "Pass: $pass"
www="/home/$1/public_html"
mkdir $www
chown $1:$1 $www -R
chmod 777 -R $www
echo "public_html created"
sh ./createdb.sh $1 $1 $MYSQL_pass
echo "Database created"
echo "Name: $1"
echo "Database: $1"
echo "Pass: $MYSQL_pass"
mail="$1_mail.txt"
sed_name='s/${name}/'$1'/'
sed_pass='s/${pass}/'$pass'/'
sed_mysqlpass='s/${MYSQL_pass}/'$MYSQL_pass'/'
2020-09-18 12:35:37 +00:00
sed_server='s/${IP}/'$IP'/'
2014-01-07 15:55:06 +00:00
sed -e $sed_name \
-e $sed_pass \
-e $sed_mysqlpass \
-e $sed_server < mail.txt > $mail
#sh ./mail.sh $1 $pass $MYSQL_pass