[ main.sh ]
pwd : /backup/shell
#vi ./main.sh
===================================================================================================
#!/bin/bash
clear
echo "=================================="
echo " 1. 사용자 관련"
echo " 2. 권한 관련"
echo " 3. 하드웨어 관련"
echo " 4. 검색 관련"
echo " 5. 시스템 종료"
echo " q. 프로그램 종료"
echo "=================================="
echo -n "메뉴를 선택 해볼래? : "
read tac1
echo "$tac1 을 선택하였습니다."
case $tac1 in
1)./user/usermain.sh;;
2)./ch/chmain.sh;;
3)./hard/hdmain.sh;;
4)./search/search.sh;;
5)./sys/sysinfo.sh;;
q)exit;;
esac
===================================================================================================
[ useradd.sh ]
pwd : /backup/shell/user
#vi ./useradd.sh
===================================================================================================
#!/bin/bash
clear
echo "================================"
echo "입력할 사용자 정보를 넣어주세요."
echo "================================"
echo -n "UserName 을 입력하세요 : "
read uaddname
if [ -z $uaddname ]
then
echo "빈값을 입력하여 프로그램을 종료합니다."
exit
else
uaddname="$uaddname"
fi
echo -n "Uid 를 입력하세요 : "
read uadduid
if [ -z $uadduid ]
then
echo "빈값을 입력하였습니다."
else
uadduid="-u $uadduid"
fi
echo -n "Gid 를 입력하세요 : "
read uaddgid
if [ -z $uaddgid ]
then
echo "빈값을 입력하였습니다."
else
uaddgid="-g $uaddgid"
fi
echo -n "Home Directory 를 입력하세요 : "
read uaddhome
if [ -z $uaddhome ]
then
echo "빈값을 입력하였습니다."
else
uaddhome="-d $uaddhome"
fi
useradd $uadduid $uaddgid $uaddhome $uaddname
echo "입력하신 $uaddname 으로 생성하였습니다"
echo "================================"
echo -n "생성된 사용자 정보를 보시겠습니까?(yes/no) : "
read catuser
if [ -z $catuser ]
then
echo "꺼져!"
/backup/sh/main.sh
else
if [ $catuser = "yes" ]
then
cat /etc/passwd | grep $uaddname
echo -n "확인하셨습니까?"
read
/backup/sh/main.sh
else
echo "빠욤!"
/backup/sh/main.sh
fi
fi
===================================================================================================
[ usermod.sh ]
pwd : /backup/shell/user
#vi ./usermod.sh
===================================================================================================
#!/bin/bash
clear
echo "================================"
echo "수정할 사용자 정보를 넣어주세요."
echo "================================"
echo -n "UserName 을 입력하세요 : "
read umodname
if [ -z $umodname ]
then
echo "빈값을 입력하여 프로그램을 종료합니다."
exit
else
umodname="$umodname"
fi
echo -n "Uid 를 입력하세요 : "
read umoduid
if [ -z $umoduid ]
then
echo "빈값을 입력하였습니다."
else
umoduid="-u $umoduid"
fi
echo -n "Gid 를 입력하세요 : "
read umodgid
if [ -z $umodgid ]
then
echo "빈값을 입력하였습니다."
else
umodgid="-g $umodgid"
fi
echo -n "Home Directory 를 입력하세요 : "
read umodhome
if [ -z $umodhome ]
then
echo "빈값을 입력하였습니다."
else
umodhome="-d $umodhome -m"
fi
usermod $umoduid $umodgid $umodhome $umodname
echo "입력하신 $umodname 으로 생성하였습니다"
echo "================================"
echo -n "수정된 사용자 정보를 보시겠습니까?(yes/no) : "
read catuser
if [ -z $catuser ]
then
echo "꺼져!"
/backup/shell/main.sh
else
if [ $catuser = "yes" ]
then
cat /etc/passwd | grep $umodname
echo -n "확인하셨습니까?"
read
/backup/shell/main.sh
else
echo "빠욤!"
/backup/shell/main.sh
fi
fi
===================================================================================================
[ userdel.sh ]
pwd : /backup/shell/user
#vi ./userdel.sh
===================================================================================================
#!/bin/bash
clear
echo "================================"
echo "삭제할 사용자 정보를 넣어주세요."
echo "================================"
echo -n "UserName 을 입력하세요 : "
read udelname
if [ -z $udelname ]
then
echo "빈값을 입력하여 프로그램을 종료합니다."
exit
else
echo "홈디렉터리도 함께 삭제하시겠습니까?(yes/no) : "
read udelmax
if [ $udelmax = "yes" ]
then
userdel -r $udelname
else
userdel $udelname
fi
fi
echo "입력하신 $udelname 사용자를 삭제하였습니다"
echo "================================"
echo -n "삭제된 사용자 정보를 보시겠습니까?(yes/no) : "
read catuser
if [ -z $catuser ]
then
echo "꺼져!"
/backup/sh/main.sh
else
if [ $catuser = "yes" ]
then
cat /etc/passwd | grep $udelname
echo -n "삭제되셨습니까?"
read
/backup/sh/main.sh
else
echo "빠욤!"
/backup/sh/main.sh
fi
fi
===================================================================================================