B / Y / U / S
HOME 웹 호스팅 도메인 매뉴얼 고객지원 설정정보 계정신청 2025-05-20 Tuesday 
웹 호스팅
# 공지 사항
# 자주 묻는 질문
# 질문과 답변
# 가입 문의
커뮤니티
# 자유게시판
# 리눅스팁
# 아이큐 테스트
# 내홈 소개
# 겔러리
# 자료실

  리눅스팁  Go Unix Power Tools Online Book Go Bash Guide
Read No. 110 article 2002-02-23 09:19:18
NickName   풀비누
Subject   비누가 쓰는 계정&디비 생성 스크립트
[root@Tina zboard]# 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 777 /home/$1/htmlroot/zboard

         # 웹호스팅 홈피 계정정보 관련 스크립트 실행
                 /etc/startup/homelink.sh

         # 제로보드 이용 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>" >> /home/$1/htmlroot/index.html
 
        if [ "$zbd" = "n" ] || [ "$zbd" = "N" ]; then 
        echo "<br>" >> /home/$1/htmlroot/index.html
        else 
        echo "제로보드 설치 버젼 : 4.1 (from 2002.2.23)<br>" >> /home/
$1/htmlroot/index.html
        echo "<a href=/~$1/zboard/install.php>설치화면가기</a><br><br>" 
>> /home/$1/htmlroot/index.html
        fi 

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
Regist Addr [ 192.168.0.2 ] 목록보기 윗글 아랫글
정규표현식 [ 상세 검색 ]
Page Loading [ 0.03 Sec ] SQL Time [ 0 Sec ]

Copyleft 1999-2025 by JSBoard Open Project
Theme Designed by IDOO And follow GPL2

개인정보 취급방침 이용 약관 사이트 맵 어드민 관리