>> Delete No. 2252 article
No. [호스팅] 계정&디비 추가 스크립트

등록 2002-02-22 15:47:00     조회 5
이름 풀비누    

		죄송합니다. html 에 체크하는 바람에..-_-;
여러곳에 있는 것을 짜집기 해서 만들었습니다.
부족하지만 참고하시기 바랍니다.
 계정아이디=디비네임=디비유저, 계정비번=디비비번과 같도록
처리하였습니다. 
 [root@Tina /]# cat /usr/sbin/addon
#!/bin/sh
          if [ $# = 0 ] # 그냥, addon하면 나오는 부분
         then
                 echo ""
                 echo "addon is Tina's user creator"
                 echo "usage: addon user_name"
                 echo ""
                 exit 1
         fi
          echo ""
         echo "Starting addon:   Running configure..." # 말장난이 조금
많죠...
         echo ""
          # 이미 유저가 존재할 수 있으므로 if문을 섰구요.. 유저가 있으
면
         # 스크립트가 종료됩니다.
          if useradd $1
         then         
                 passwd $1 # 패스워드 부여!
                 echo ""
                 echo "$1 is"
                 echo "`id $1` &" # 유저를 확인하는 차원에서...
          # /etc/skel/htmlroot/zboard 자 계정이 생성되면서 자동으로 복사
                  chmod 711 /home/$1 
                 chmod 707 /home/$1/htmlroot/zboard
          # 제로보드 이용 or 불이용 확인
 echo -n "Zboard Install - [Y/N](default Y) : "
read zbd
        if [ "$zbd" = "n" ] || [ "$zbd" = "N" ]; then
                 rm -rf /home/$1/htmlroot/zboard
                 echo "zboard is removed"
        fi
        # 계정 생성후 메세지
                  echo "Home Permission=711, tokens updated
successfully!"
                 echo ""
         # 계정 사용자의 index.html 문서 생성
 rm -rf /home/$1/htmlroot/index.html
 echo "" >> /home/$1/htmlroot/index.html
echo "<html>" >> /home/$1/htmlroot/index.html
echo "<body bgcolor=black>" >> /home/$1/htmlroot/index.html
echo "<table align=center>" >> /home/$1/htmlroot/index.html
echo "<tr>" >> /home/$1/htmlroot/index.html
echo "<td align=center>" >> /home/$1/htmlroot/index.html
echo "<br>" >> /home/$1/htmlroot/index.html
echo "<br>" >> /home/$1/htmlroot/index.html
echo "<font color=ffcc66>" >> /home/$1/htmlroot/index.html
echo "<h3>TINA.WOWDNS.COM</h3>" >> /home/$1/htmlroot/index.html
echo "<h1>회원님의 가입을 축하드립니다.</h1>" >>
/home/$1/htmlroot/index.html
echo "</font>" >> /home/$1/htmlroot/index.html
echo "</td>" >> /home/$1/htmlroot/index.html
echo "</tr>" >> /home/$1/htmlroot/index.html
echo "<tr>" >> /home/$1/htmlroot/index.html
echo "<td align=right>" >> /home/$1/htmlroot/index.html
echo "<br>" >> /home/$1/htmlroot/index.html
echo "<br>" >> /home/$1/htmlroot/index.html
echo "<br>" >> /home/$1/htmlroot/index.html
echo "<br>" >> /home/$1/htmlroot/index.html
echo "<br>" >> /home/$1/htmlroot/index.html
echo "<br>" >> /home/$1/htmlroot/index.html
echo "<h4>" >> /home/$1/htmlroot/index.html
echo "<font color=cyan>" >> /home/$1/htmlroot/index.html
echo "가입일 : $('date')<br><br>" >> /home/$1/htmlroot/index.html
echo "</font>" >> /home/$1/htmlroot/index.html
echo "<font color=dddddd>" >> /home/$1/htmlroot/index.html
echo "웹주소 : http://cel.xdns.co.kr:8888/~$1<br>" >>
/home/$1/htmlroot/index.html
echo "http://tina.wowdns.com/~$1<br>" >>
/home/$1/htmlroot/index.html
echo "</font>" >> /home/$1/htmlroot/index.html
echo "<br>" >> /home/$1/htmlroot/index.html
echo "<br>" >> /home/$1/htmlroot/index.html
echo "<a href=/><font color=dddddd>홈으로</font></a><br>"
>> /home/$1/htmlroot/index.html
echo "</h4>" >> /home/$1/htmlroot/index.html
echo "</td>" >> /home/$1/htmlroot/index.html
echo "</tr>" >> /home/$1/htmlroot/index.html
echo "</table>" >> /home/$1/htmlroot/index.html
echo "</body>" >> /home/$1/htmlroot/index.html
echo "</html>" >> /home/$1/htmlroot/index.html
 chown $1.$1 /home/$1/htmlroot/index.html
 ### DB SETTING ###
 echo -n "$1 -DB Passwd:"
read PASS
 echo "create database $1;" > /tmp/useradd.sql
echo "grant all privileges on $1.* to $1@localhost identified
by '${PASS}';" >>
/tmp/useradd.sql
 #echo "use mysql;" > /tmp/useradd.sql
#echo "create database $1;" >> /tmp/useradd.sql
#echo "insert into user (Host,User,Password)
values('localhost','$1',password('${PASS}'));" >> /tmp/useradd.sql
#echo "insert into db
values
('localhost','$1','$1','y','y','y','y','y','y','y','y','y','y');" >>
/tmp/useradd.sql
#echo "flush privileges;" >> /tmp/useradd.sql
 # mysql -u root -p비밀번호 mysql < /tmp/useradd.sql
mysql < /tmp/useradd.sql
rm -rf /tmp/useradd.sql
                  exit
         else
                 echo ""
                 exit 1
          fi--니끼가? 내끼다. 니해뿌라~ ^^;
[관리자] 패스워드를 입력 하십시오. 답장이 존재하면 함께 삭제됩니다.[ 목록 | 이전 ]
패스워드:    

Copyleft 1999-2026 by JSBoard Open Project
Theme Designed by IDOO All right reserved