¾îÁ¦¿¡ ÀÌ¾î ¿À´ÃÀº È°¿ë±â 2źÀ» Àû¾îº¾´Ï´Ù..
¾îÁ¦ ±ÛÀ» º¸´Ï ÇѱÛÀÔÃâ·ÂÀÌ µÇ´Â°Í¸¸ º¸¿©µå·ÈÁö.. °è¼ÓÇؼ Àû¿ëµÇ°Ô ÇÏ´Â ºÎºÐÀº
Àû¾îµå¸®Áö ¾Ê¾Ò³×¿ä... ¤Ñ¤Ñ¤»
¿À´Ã ³»¿ë°ú ÇÔ²² Àû¿ëÇÏ½Ã¸é µÉ°Å °°½À´Ï´Ù.. ^^
¿À´ÃÀº ¸¶Å¬ 2¼¼´ëÀÇ °¡Àå Â¥Áõ³ª´Â... ºÎÆÃÇÏ¸é ¸ðµç ¼³Á¤ÀÌ ´Ù ³¯¶ó°¡´Â ºÎºÐÀ»
ÇØ°áÇØ º¸·Á°í ÇÕ´Ï´Ù..
¸ÕÀú ¼³Ä¡µÈ ÇÁ·Î±×·¥ÀÌ ³¯¶ó°¡´Â°Ç È°¿ë±â 1źÀ» ÅëÇؼ ¼³Ä¡ÇϽøé ÇØ°áµÇ½Ê´Ï´Ù..
±×·³ ±×´ÙÀ½ ¹®Á¦ÀÎ °¢Á¾ º¯°æµÈ... ³» ÀÔ¸À¿¡ ¸Âµµ·Ï ¹Ù²Û ¼³Á¤µéÀÌ ³¯¶ó°¡´Â°Ô ¾Æ´Ñ°¡ ÇÕ´Ï´Ù.
¿À´ÃÀº ÀÌ ³»¿ëÀ» Á¤¸®Çغ¸·Á°í ÇÕ´Ï´Ù..
ÀÌ ³»¿ëÀº ½Ã½ºÅÛ ¼³Á¤À» º¯°æÇϴ°Ŷó...
Àͼ÷Ä¡ ¾ÊÀ¸½ÅºÐµéÀº ¹Ýµå½Ã µÎ¼¼¹ø Á¤µ¶ÇÏ½Ã°í ½É»ç¼÷°íµÚ¿¡ Àû¿ëÇϼ¼¿ä!
¾È±×·³ ÀçºÎÆýà ¸¶Å¬ ¾ÈÄÑÁý´Ï´Ù ¤Ñ¤Ñ;;;
----------------------------------------------------------------------------
1. nano ÆíÁý±â ¼³Ä¡
Àú´Â vi¸¦ ¼±È£Çؼ nano ÆíÁý±â´Â Àß»ç¿ë¸øÇÏÁö¸¸...
¸¹Àº ºÐµéÀÌ nano¸¦ ¼±È£ÇϽô µíÇؼ ¼³Ä¡ÆÄÀÏÀ» ¸¸µé¾î ºÃ½À´Ï´Ù..
¾Æ·¡ bin ÆÄÀÏÀ» ´Ù¿î¹Þ¾Æ.. È°¿ë±â 1źÀÇ ³»¿ëÀ» Âü°íÇØ ¼³Ä¡Çϼ¼¿ä~
- ncurses : https://1drv.ms/u/s!AtRS837FSxcQgzkj5ZyaoTh6yN0a
- nano : https://1drv.ms/u/s!AtRS837FSxcQgzgQUFsX5pZ1Qxo2
- È°¿ë±â 1ź : http://www.ppomppu.co.kr/zboard/view.php?id=nas&page=1&divpage=5&no=25246
¼º°øÀûÀÎ ¼³Ä¡ÈÄ ±×³É nano¸¦ ½ÇÇàÇÏ½Ã¸é ¿À·ù°¡ ¹ß»ýÇÕ´Ï´Ù..
¾Æ·¡ ¸í·É¾î¸¦ ssh·Î Á¢¼ÓÇØ ¼öÇàÇØÁÖ¼¼¿ä..
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
¾Æ·¡ ȸéÀº À§ ¸í·É¾î ¼öÇà ÀüÈÄ ½ÇÆÐ¿Í ¼º°øÀÇ ¸ð½ÀÀÔ´Ï´Ù..
2. ½Ã½ºÅÛ ¼³Á¤ÆÄÀÏ ¼öÁ¤ ==> ÁÖÀÇ: À߸øÇÏ½Ã¸é ¸¶Å¬ ÃʱâÈÇؾßÇÕ´Ï´Ù!!!
À̹ø¿¡ »ìÆ캼 ÆÄÀÏÀº /usr/local/config/config.xml ÆÄÀÏÀÔ´Ï´Ù..
·çÆ®(/) µð·ºÅ丮´Â ·¥µð½ºÅ©¹æ½ÄÀÌ¾î¼ ¸®ºÎÆÃÈÄ¿¡´Â ¸ðµç°Ô ÃʱâÈ µÇ¹ö¸®ÁÒ...
±Ùµ¥ À§ ȸéÀ» º¸½Ã¸é /usr/local/config °¡ /dev/sda7 ÀÎ °ÍÀ» º¸½Ç¼ö ÀÖ½À´Ï´Ù.
³×... ÀϹݵð½ºÅ©ÀÔ´Ï´Ù.. ¸®ºÎÆÃÈÄ¿¡µµ º¯°æ»çÇ×ÀÌ À¯ÁöµÇÁÒ...
µû¶ó¼, À§ config.xml À» ¼öÁ¤Çصµ ¸®ºÎÆÃÈÄ¿¡´Â ±×´ë·Î À¯ÁöµË´Ï´Ù..
Áï!!! À߸øº¯°æÇÏ½Ã¸é ½Ã½ºÅÛ ºÎÆþȵ˴ϴÙ... ¤Ñ¤Ñ;
±×·³ /usr/local/config/config.xml ÆÄÀÏÀ» ÆíÁý±â·Î ¿±´Ï´Ù..
±×¸®°í crond ¶ó´Â ű׸¦ ã¾Æ°©´Ï´Ù.. 181¹ø° ÁÙÀÔ´Ï´Ù.
vi¸¦ ¾²½Ã´Â °æ¿ì, 181G, z, enter-key ¸¦ Â÷·Ê·Î ´©¸£½Ã¸é... ÇØ´ç űװ¡ ȸéÀÇ »ó´ÜÀ¸·Î ¿Ã¶ó¿Ã ²®´Ï´Ù..
¾Æ·¡´Â Á¦ config.xml ÆÄÀÏÀÇ ÇØ´ç ºÎºÐÀÔ´Ï´Ù...
ȸ»öÀ¸·Î ¼±ÅÃµÈ ºÎºÐÀ» º¸½Ã¸é... À̱ÛÀ» º¸½Ã´Â ºÐÀÇ ÆÄÀÏ°ú ºñ±³ÇØ 1, 2 ±×¸®°í run űװ¡ ¼öÁ¤µÈ°ÍÀ» È®ÀÎÇÏ½Ç ¼ö ÀÖÀ»²®´Ï´Ù..
¸ÕÀú 1, 2 ű״ 30, 2¿¡¼ * ·Î.....
±×¸®°í run ű״ stime¿¡¼ user_script.sh ·Î º¯°æµÆ½À´Ï´Ù..
stimeÀº ntp¸¦ ÀÌ¿ëÇØ ½Ã°¢µ¿±âÈÇÏ´Â ÇÁ·Î±×·¥ÀÔ´Ï´Ù....
ÀÌ°É »©°í ´ë½Å ¿ì¸®°¡ ºÎÆýø¶´Ù ¼öÇàÇÒ user_script.sh ·Î º¯°æÇÑ °ÍÀÔ´Ï´Ù..
±×¸®°í stimeÀº 2½Ã 30ºÐ¿¡ ¼öÇàÇÏ°Ô µÇ¾îÀִµ¥ ÀúÈñ´Â ºÎÆÃÀ» ¾ðÁ¦ ÇÒÁö ¸ð¸£´Ï..
º°Ç¥(*) Áï 1ºÐ¸¶´Ù ¼öÇàÇÏ°Ô º¯°æÇß½À´Ï´Ù..
±×¸®°í ÀÌ 1ºÐ¸¶´Ù ¼öÇàµÇ´Â °Ç ´Ù½Ã user_script.sh ³»ºÎÀûÀ¸·Î ¸·À» ¿¹Á¤ÀÔ´Ï´Ù..
3. user_script.sh »ý¼º ¹× ¼öÁ¤
ÀÌÁ¦ Á¦ user_script.sh ¸¦ º¸µµ·Ï ÇÏÁÒ...
1 #!/bin/sh
2
3 HOME_DIR=/mnt/HD/HD_a2/.private
4 CONFIG=/usr/local/config
5 CRONTAB=/var/spool/cron/crontabs/root
6 BOOTRUN=/.bootscript-run
7
8 cp $HOME_DIR/root/$CRONTAB $CRONTAB
9
10 if [ -f $BOOTRUN ]; then exit 0
11 fi
12 touch $BOOTRUN
13
14 #------------------------------------------------------------------
15 XROOT=`dirname $HOME_DIR`
16
17 mounted=0
18 for i in `seq 1 10`
19 do
20 mounted=`mount | grep "$XROOT" | wc -l`
21 if [ $mounted > 0 ]; then
22 break
23 fi
24 sleep 1
25 done
26
27 if [ $mounted == 0 ]; then exit 0
28 fi
29
30
31 mount --bind ${HOME_DIR}/root/home /home
32
33
34 chmod u+s /bin/tinylogin
35
36
37 cp -f $HOME_DIR/root/etc/ssh/sshd_config /etc/ssh/sshd_config
38 kill -HUP `cat /var/run/sshd.pid`
39
40
41 if [ -f /bin/which ]; then
42 rm -f /bin/which
43 fi
44 ln -s /bin/busybox /bin/which
45
46
47 awk 'BEGIN { FS = ":" }
48 {
49 if ($1 == "root") {
50 for (i = 1; i < NF; i++) printf ("%s:", $i)
51 printf ("/bin/bash\n")
52 } else printf ("%s\n", $0)
53 }' /etc/passwd >> /tmp/passwd.tmp
54 mv -f /tmp/passwd.tmp /etc/passwd
55 chmod 644 /etc/passwd
56
57
58 #------------------------------------------------------------------
59 f=`basename $0`
60 diff $HOME_DIR/root/$CONFIG/$f $CONFIG/$f 2>&1 >> /dev/null
61 if [ $? != 0 ]; then
62 cp $CONFIG/$f $HOME_DIR/root/$CONFIG/$f 2>&1 >> /dev/null
63 fi
64
65 exit 0
==> À§ ½ºÅ©¸³Æ® ³»¿ëÁß, 4¹ø° 5¹ø° ¶óÀο¡ CONFIG¿Í CRONTAB ȯ°æº¯¼ö°¡ ConFIG, CRonTAB À̶ó°í º¸À̳׿ä... ½ÇÁ¦ ¼öÁ¤ÇÏ·Á°í µé¾î°¡¸é µÎ ´Ü¾îÀÇ ONÀÌ ´ë¹®ÀÚÀε¥.. º¸À̴°͸¸ ¼Ò¹®ÀÚ·Î º¸À̴°Š°°½À´Ï´Ù..
ÀÛ¾÷½Ã¿¡ ÁÖÀÇÇϼ¼¿ä~
¾Õ¿¡ ÀÖ´Â ÁÙ ¸Ç¼ýÀÚ´Â ¼³¸íÀ» À§ÇÑ ¼ýÀÚÀÔ´Ï´Ù...
Áï, ½ÇÁ¦ user_script.sh ¿¡´Â ÀûÀ¸½Ã¸é ¾ÈµË´Ï´Ù...
Âü°í·Î ÆÄÀÏ ³»¿ëÀÌ ³Ê¹« ±æ¾îÁ®... Á¦ ½ÇÁ¦ ÆÄÀÏ¿¡ ÀÖ´Â ÁÖ¼®Àº ´Ù Á¦°ÅÇÏ°í ½ÇÁ¦ Äڵ常 °¡Á®¿Ô½À´Ï´Ù..
(8¶óÀÎ)
config.xml ÆÄÀÏÀ» Á¦°¡ ¸»¾¸µå¸°´ë·Î ¼öÁ¤Çϸé.. root crontab ÆÄÀÏ¿¡ user_script.sh °¡ 1ºÐ¸¶´Ù ¼öÇàµÇµµ·Ï
µî·ÏµË´Ï´Ù.. ÀÌ°É ¸·±â À§Çؼ user_script.sh °¡ µî·ÏµÇÁö ¾ÊÀº root crontab ÆÄÀÏÀ» µû·Î ÀúÀåÇØ
¸®ºÎÆÃÀÌ µÉ¶§¸¶´Ù ¿øº¹ÇØÁÝ´Ï´Ù..
(10~12¶óÀÎ)
user_script.sh °¡ Áߺ¹¼öÇàµÇ´Â°É ¸·½À´Ï´Ù..
(17~28¶óÀÎ)
/mnt/HD/HD_a2 °ø°£Àº ½Ã½ºÅÛ ÃʱâÈ¿¡µµ Æß¿þ¾î ¾÷µ¥ÀÌÆ®¿¡µµ º¯°æµÇÁö ¾Ê´Â ¿µ¿ªÀÔ´Ï´Ù..
Áï, 1¼¼´ë·Î µûÁö¸é /DataVolume ¿µ¿ªÀÎ °÷ÀÔ´Ï´Ù..
µû¶ó¼ Àú´Â ÀúÀÇ ¸ðµç °³ÀÎÀûÀÎ ¼³Á¤À» /mnt/HD/HD_a2 ¿µ¿ª¿¡ ÀúÀåÇØ µÎ°í »ç¿ëÇÕ´Ï´Ù..
Çؼ ¸®ºÎÆýÿ¡ °¢Á¾ °³Àμ³Á¤À» /mnt/HD/HD_a2 ¿µ¿ª¿¡¼ °¡Á®¿Í¾ßÇϴµ¥...
¸¸¾à user_script.sh °¡ ÀúÀåµÈ /usr/local/config ¸¶¿îÆ®Æ÷ÀÎÆ® ¸¶¿îÆ®ÈÄ user_script.sh °¡ ¼öÇàµÇ±â Àüº¸´Ù
/mnt/HD/HD_a2 °¡ ¸¶¿îÆ®µÇÁö ¾Ê´Â´Ù¸é???
±×·³ °¢Á¾ °³Àμ³Á¤À» °¡Á®¿ÀÁö ¸øÇØ user_script.sh°¡ ¿À·ù°¡ ¹ß»ýÇÒ²¨°í.. ±× ¿À·ù´Â ½Ã½ºÅÛÀÌ
Á¤»ó ºÎÆõÇÁö ¾Ê°ÔÇÒ¼ö µµ ÀÖÀ»°Ì´Ï´Ù..
±×·¡¼ Àú´Â user_script.shÀÇ ÁÖ¿ä ÀÛ¾÷(?)ÀÌ ¼öÇàµÇ±âÀü /mnt/HD/HD_a2 °¡ Á¤»ó ¸¶¿îÆ®µÇ¾ú´ÂÁö È®ÀÎÇÏ°í
ºñÁ¤»óÀÌ¸é ±×³É user_script.sh ¸¦ Á¾·á½ÃÅ°µµ·Ï Çß½À´Ï´Ù..
¹°·Ð Á¤»óÀûÀÎ °æ¿ì¿¡ /mnt/HD/HD_a2 °¡ user_script.sh °¡ µ¹±âÀü¿¡ ¸¶¿îÆ® ¾ÈµÉÀÏÀº ¾ø°ÚÁÒ.. ^^
(31¶óÀÎ)
¾Æ½±°Ôµµ 2¼¼´ë¿¡¼ /home µð·ºÅ丮´Â ÀϹݵð½ºÅ©°¡ ¾Æ´Ñ ·¥µð½ºÅ©¿¡ ÀúÀåµË´Ï´Ù..
Áï ¸®ºÎÆýÿ¡ /home µð·ºÅ丮¿¡ ÀúÀåµÈ ¸ðµç ³»¿ëÀÌ ÃʱâȵǴ°ÅÁÒ....
±×·¡¼ ÀÌ°É ¸·À¸·Á°í... /mnt/HD/HD_a2 ¿¡ ¹°¸®ÀûÀÎ home µð·ºÅ丮¸¦ ¸¸µé°í
ºÎÆýÿ¡ ÀÌ°É binding ½ÃÄÑ ¸®ºÎÆÃÈÄ¿¡µµ home µð·ºÅ丮ÀÇ ³»¿ëÀÌ À¯ÁöµÇµµ·Ï Çß½À´Ï´Ù.. ^^
(37~38¶óÀÎ)
¸¶Å¬Àº ±âº»ÀûÀ¸·Î SSH »ç¿ë ¼³Á¤½Ã, sshd ¿Í root °èÁ¤À¸·Î¸¸ ssh Á¢¼ÓÀÌ °¡´ÉÇÕ´Ï´Ù..
ÀÌ´Â º¸¾È¿¡ ¸Å¿ì Ãë¾àÇÕ´Ï´Ù!!
±×·¡¼ Àú´Â °³ÀÎ °èÁ¤À» º°µµ »ý¼ºÇÏ°í ssh Á¢¼Ó°ú °ü·ÃÇØ °³ÀΰèÁ¤Àº Á¢¼ÓÇã¿ë, sshd ¹× root´Â Á¢¼ÓÀ» ºÒÇãÇØ
»ç¿ëÇÏ°í ÀÖ½À´Ï´Ù..
±×·¯³ª ÀÌ¿ª½Ã ¸®ºÎÆõǸé ÃʱâÈ µÇ°ÚÁÒ??? ±×·¡¼ Á¦ °³Àμ³Á¤À¸·Î ¸ÂÃçÁø sshd_config ÆÄÀÏÀ» ¹Ð¾î³Ö´Â ÀÛ¾÷´Ï´Ù.
(47~55¶óÀÎ)
Àú´Â °³ÀÎÀûÀ¸·Î bash¸¦ ¼±È£ÇÕ´Ï´Ù..
/etc/passwd ¿ª½Ã ¸®ºÎÆÃÈÄ¿¡´Â ¿ø·¡ ¼³Á¤ÀÎ /bin/sh ·Î µ¹¾Æ¿Í...
ºÎÆÃÈÄ sh¸¦ bash·Î º¯°æÇÏ´Â ÀÛ¾÷ÀÔ´Ï´Ù..
(59~63¶óÀÎ)
¿©±â´Â ÀÌó·³ Áß¿äÇÑ /usr/local/config/user_script.sh ¿¡ ´ëÇÑ ¹é¾÷À» ¸¸µå´Â ÀÛ¾÷ÀÔ´Ï´Ù..
½Ã½ºÅÛ ¿î¿µÇÒ¶§ ¹é¾÷¸¸Å Áß¿äÇÑ °ÍÀº À̼¼»ó¿¡ ¾ø½À´Ï´Ù!!
user_script.sh¸¦ ÆíÁý±â·Î »ý¼ºÇÑ µÚ¿¡´Â ¾Æ·¡ ¸í·É¾î¸¦ Çѹø ¼öÇàÇØÁÖ¼¼¿ä..
chmod 755 /usr/local/config/user_script.sh
4. »çÀü ¼öÇà ¸í·É¾îµé
ÀÌÁ¦ À¯´Ð½º³ª ¸®´ª½º °æÇèÀÌ ÀûÀ¸½Å ºÐµéÀº À§±Û¸¸ º¸¸é ¸Õ¼Ò¸°Áö ¿Ü°è¾îó·³ º¸À̽Dz®´Ï´Ù..
±×·¡¼ °£·«ÇÏ°Ô °ü·ÃµÈ ¸í·É¾î µîÀ» Á¤¸®ÇغýÀ´Ï´Ù.. ssh Á¢¼ÓÈÄ root·Î ¼öÇàÇÏ½Ã¸é µË´Ï´Ù.
umask 022
mkdir -p /mnt/HD/HD_a2/.private/root/usr/local/config
mkdir -p /mnt/HD/HD_a2/.private/root/etc/ssh
mkdir -p /mnt/HD/HD_a2/.private/root/var/spool/cron/crontabs
cp -R /home /mnt/HD/HD_a2/.private/root
cp /etc/ssh/sshd_config /mnt/HD/HD_a2/.private/root/etc/ssh
crontab -l >> /mnt/HD/HD_a2/.private/root/var/spool/cron/crontabs/root
@ /usr/local/config/config.xml ¼öÁ¤
@ /usr/local/config/user_script.sh »ý¼º ¹× ¼öÁ¤
@ /mnt/HD/HD_a2/.private/root/etc/ssh/sshd_config ¸¦ ÀÔ¸À¿¡ ¸Â°Ô ¼öÁ¤
chmod 755 /usr/local/config/user_script.sh
cp /usr/local/config/user_script.sh /mnt/HD/HD_a2/.private/root/usr/local/config
´ë·« À§¿¡Ã³·³ Çϸé... Á¦²¨ ½ºÅ©¸³Æ®µéÀÌ Á¤»óÀûÀ¸·Î ¼öÇàµÉ°Å °°½À´Ï´Ù.. ¤»
ƯÈ÷ À§¿¡¼ @ ... ·Î Ç¥ÇöµÈ ºÎºÐÀº ¼öÇà ¶Ç´Â º¹ºÙÀÌ ¾Æ´Ñ.. ½ÇÁ¦ ÆÄÀÏ ¼öÁ¤À» ÀǹÌÇϴ°̴ϴÙ~
5. Çѱۻç¿ëÀ» À§ÇÑ .profile ¼öÁ¤
±×¸®°í ¸¶Áö¸·À¸·Î È°¿ë±â 1ź¿¡ ÀÖ´ø ÇѱÛÀÔÃâ·ÂÀ» ÀÚÀ¯·Ó°Ô Çϱâ À§ÇØ ¾Æ·¡ ³»¿ëÀ»...
/mnt/HD/HD_a2./.private/root/home/root/.profile ¿¡ Ãß°¡ÇϽñ⠹ٶø´Ï´Ù..
.profile ÀÌ Ã³À½ºÎÅÍ ¾ø´ø ºÐÀÌ ´ëºÎºÐÀÏÅ×´Ï »õ·Î »ý¼ºÇϼż Ãß°¡ÇÏ¼Å¾ß ÇÕ´Ï´Ù..
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export PATH=/usr/local/bin:$PATH:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
ÀÌÁ¦ È°¿ë±â 2źÀÌ ¾óÃß Á¤¸®°¡ ´Ù µÈ°Å °°½À´Ï´Ù..
3źÀ¸·Î À̾°Ô ÀÖ´ÂÁö °í¹ÎÇغÁ¾ß°Ú³×¿ä...
±×·³ À̸¸ ¸¶Ä¡°Ú½À´Ï´Ù..
PS. Á¤¸»Á¤¸»... ¼öÁ¤½Ã ²Ä²ÄÈ÷ È®ÀÎÇÑÈÄ¿¡ ¼öÁ¤Çϼ¼¿ä..
±×¸®°í ¸®ºÎÆÃÀü¿¡ user_script.sh °¡ Àß¼öÇàµÇ´ÂÁö ¼öÇàÇغ¸¼¼¿ä!!!
---------------------------------
@ ´Ù¸¥°÷À¸·ÎÀÇ ºÒÆßÀº ±ÝÁöÀÔ´Ï´Ù!!
±Ã±ÝÇÏ½Å°Ô ÀÖÀ¸½Ã¸é ´Ù¸¥ ºÐµéµµ ÇÔ²² º¸½Ç¼ö ÀÖ°Ô ´ñ±Û·Î ºÎŹµå¸³´Ï´Ù..
Ȥ½Ã³ª ÂÊÁö·Î ÁÖ½Ã¸é ´äº¯µå¸®Áö ¾Ê°Ú½À´Ï´Ù..
@ º» ³»¿ëÀº wd °ø½ÄÄ¿¹Â´ÏƼ¿¡ ÀÖ´Â °¢Á¾ ³»¿ë°ú Á¦½º½º·ÎÀÇ ³¡¾ø´Â »ðÁú·Î ¿Ï¼ºÇÑ ³»¿ëÀÓÀ» ¾Ë·Áµå¸³´Ï´Ù. ¤»
|
2.21.119 ÀÔ´Ï´Ù...