만두야닷컴

#!/bin/bash
 
clear
 
echo ==================================================================
echo "                     UserAdd Process Start                      "
echo ==================================================================
 
echo -n "User Name : "
read username
useradd $username
echo ------------------------
echo PassWord Setting
echo ------------------------
passwd $username
 
echo ==================================================================
echo "                     www root directory making                      "
echo ==================================================================
echo
echo -n "www root Directory path : "
echo /home/$username/www
mkdir -p /home/$username/www
 
echo ==================================================================
echo "             root directory setting & test index.php making     "
echo ==================================================================
chmod 775 /home/$username
chmod 707 /home/$username/www
chown $username.$username /home/$username/www
echo " " >>/home/$username/www/index.php
echo "<? phpinfo(); ?>" >> /home/$username/www/index.php
chown $username.$username /home/$username/www/index.php
chmod 775 /home/$username/www/index.php
 
echo checking -----------------------------------------------------------
ls -al /home/$username
echo checking -----------------------------------------------------------
ls -al /home/$username/www
 
 
echo ==================================================================
echo "                        MySQL useradd"
echo ==================================================================
echo "Username : $username"
echo "dbname : $username"
echo -n "User p/w : "
read userpw
echo " " >> mysql_useradd.sql
echo "use mysql;" >> mysql_useradd.sql
echo "create database $username;" >> mysql_useradd.sql
echo "grant all privileges on $username.* to $username@localhost identified by '$userpw';" >> mysql_useradd.sql
echo "FLUSH PRIVILEGES;" >> mysql_useradd.sql
/usr/bin/mysql -uroot -p비번 < ./mysql_useradd.sql
cat ./mysql_useradd.sql
rm -rf ./mysql_useradd.sql

 

 

해당자료는 제가 작성한 것이 아닙니다.

해당 출처가 명확치 않아 표기하지 않았으며, 원 제작자님이 계시면 메일이나 글 남겨 주시면 출처 표시 하도록 하겠습니다.

 

내 계정에선 mkuser 설정

 

Comment +0