· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
Linuxdoc Sgml/SMB-HOWTO

SMB HOWTO

SMB HOWTO

ÀúÀÚ: David Wood, dwood@plugged.net.au

v1.0, 10 August 1996 ÀÌ Ã¢ÇÑ, chlee@physics.soongsil.ac.kr
ÀÌ ¹®¼­´Â SMB HOWTO ÀÌ´Ù. NetBIOS ¶Ç´Â LanManager¶ó°íµµ ºÒ¸®´Â Session Message Block (SMB) ÇÁ·ÎÅäÄÝÀ» ¸®´ª½º¿¡¼­ »ç¿ëÇÏ´Â ¹æ¹ýÀ» ¼³¸íÇÑ´Ù.

1. ¼Ò°³

ÀÌ ¹®¼­´Â SMB HOWTO ÀÌ´Ù. NetBIOS ¶Ç´Â LanManager¶ó°íµµ ºÒ¸®´Â Session Message Block (SMB) ÇÁ·ÎÅäÄÝÀ» ¸®´ª½º¿¡¼­ »ç¿ëÇÏ´Â ¹æ¹ýÀ» ¼³¸íÇÑ´Ù.

ÀÌ ¹®¼­´Â David Wood ( dwood@plugged.net.au) °¡ °ü¸®ÇÑ´Ù. ´ÙÀ½ ÆÇ¿¡ Æ÷ÇԵDZ⸦ ¿øÇÏ´Â Ãß°¡, ¼öÁ¤ ¶Ç´Â Á¤Á¤¿¡ ´ëÇÑ ¸ÞÀÏÀ» ¾ðÁ¦³ª ȯ¿µÇÑ´Ù.

SMB ÇÁ·ÎÅäÄÝÀº M$ 3.11, 95, NT(¾ÕÀ¸·Î M$·Î ÃÑĪÇÏ°Ú´Ù)¿¡¼­ µð½ºÅ©¿Í ÇÁ¸°Å͸¦ °øÀ¯Çϴµ¥ »ç¿ëµÈ´Ù. Andrew TridgellÀÌ ¸¸µç »ï¹Ù µµ±¸µéÀ» ÀÌ¿ëÇؼ­ ¸®´ª½º(À¯´Ð½º)¿Í À©µµ¿ì °£¿¡ µð½ºÅ©, ÇÁ¸°ÅÍ °øÀ¯°¡ °¡´ÉÇÏ´Ù.

»ï¹Ù·Î ÇÒ ¼ö ÀÖ´Â ÀÏÀº ¾Æ·¡ÀÇ ³× °¡Áö°¡ ÀÖ´Ù.

  1. ¸®´ª½º ÆÄƼ¼Ç°ú M$¿ÍÀÇ °øÀ¯.
  2. M$ ÆÄƼ¼Ç°ú ¸®´ª½º¿ÍÀÇ °øÀ¯.
  3. ¸®´ª½ºÀÇ ÇÁ¸°ÅÍ¿Í M$¿ÍÀÇ °øÀ¯.
  4. M$ÀÇ ÇÁ¸°ÅÍ¿Í ¸®´ª½º¿ÍÀÇ °øÀ¯.

ÀÌ ³× °¡Áö¸¦ ¾ÕÀ¸·Î ¼³¸íÇÏ°Ú´Ù.

2. Á»´õ ÀÚ¼¼ÇÑ Á¤º¸¸¦ ¿øÇϸé

»ï¹Ù´Â ¸Å¿ì º¹ÀâÇÏ°íµµ ¿ÏÀüÇÑ ÆÐÅ°ÁöÀÌ´Ù. »ï¹ÙÀÇ ¸ðµç °ÍÀ» ¼³¸íÇÑ´Ù´Â °ÍÀº ÂüÀ¸·Î ¾î·Á¿î ÀÏÀÌ´Ù. ¶§¹®¿¡ ÀÌ ¹®¼­¿¡¼­´Â »ï¹ÙÀÇ È­ÀÏ, ÇÁ¸°Æ® ¼­ºñ½º¸¦ ¸®´ª½º¿¡¼­ ¾î¶»°Ô ±¸¼ºÇÏ´ÂÁö¸¦ ¼³¸íÇÒ °ÍÀÌ´Ù.

´õ ¸¹Àº Á¤º¸¸¦ ¿øÇÏ¸é ´ÙÀ½ ¹®¼­µéÀ» Âü°íÇϱ⠹ٶõ´Ù.

3. ¼³Ä¡

»ï¹ÙÀÇ °¡Àå ÃÖ±ÙÀÇ ¼Ò½º´Â ´ÙÀ½ »çÀÌÆ®¿¡¼­ ±¸ÇÒ ¼ö ÀÖ´Ù. ftp://nimbus.anu.edu.au/pub/tridge/samba/ ¶Ç´Â ´ÙÀ½ Çѱ¹ ¹Ì·¯ »çÀÌÆ®¿¡¼­ ±¸ÇÒ ¼öµµ ÀÖ´Ù. http://mirror.korea.co.kr/samba/download.html

·¹µåÇÞÀ» ¼³Ä¡ÇÑ´Ù¸é »ï¹ÙÆÐÅ°Áö´Â ¿É¼ÇÀ̹ǷΠ¼±ÅÃÀ» Çؾ߸¸ ÇÑ´Ù. ´Ù¸¥ ¹èÆ÷ÆǵéÀº »ï¹Ù ½ÇÇàÈ­ÀÏÀ» Æ÷ÇÔÇÏ°í ÀÖ´Ù.

¾Æ·¡ÀÇ µÎ µ¥¸óÀº »ï¹Ù¸¦ »ç¿ëÇϱâ À§ÇØ ²À ÇÊ¿äÇÑ °ÍÀÌ´Ù. ÀϹÝÀûÀ¸·Î /usr/sbin µð·ºÅ丮 ¾Æ·¡¿¡ ¼³Ä¡µÇ¾îÀÖ°í ½Ã½ºÅÛÀÇ Ãʱ⼳Á¤ ½ºÅ©¸³Æ®³ª inetd¿¡ ÀÇÇؼ­ ºÎÆýÿ¡ ½ÃÀ۵ǾîÁø´Ù. µ¥¸ó ½ÇÇà½ÃÅ°±â¿¡¼­ ½ºÅ©¸³Æ®ÀÇ ¿¹¸¦ º¼ ¼ö ÀÖ´Ù.


        smbd (SMB µ¥¸ó)
        nmbd (Ŭ¶óÀ̾ðÆ®¸¦ À§ÇØ  NetBIOS nameserver¸¦ Áö¿øÇÏ´Ù )

»ï¹Ù ½ÇÇàÈ­ÀϵéÀº ÀϹÝÀûÀ¸·Î /usr/bin ¾Æ·¡¿¡ ¼³Ä¡µÇÁö¸¸ ¹Ù²Ü ¼ö ÀÖ´Ù.


        smbclient       (À¯´Ð½º¸¦ À§ÇÑ »ï¹Ù Ŭ¶óÀ̾ðÆ®)
        smbprint        (»ï¹Ù È£½ºÆ®ÀÇ ÇÁ¸°ÅÍ¿¡ ÇÁ¸°Æ®¸¦ Çϱâ À§ÇÑ ½ºÅ©¸³Æ®)
        smbprint.sysv   (À§ smbprint¿Í °°Áö¸¸ SVR4 À¯´Ð½º¸¦ À§ÇÑ °ÍÀÌ´Ù)
        smbstatus       (ÇöÀçÀÇ »ï¹Ù ¿¬°á »óŸ¦ º¸¿©ÁØ´Ù) 
        smbrun          (»ï¹Ù È£½ºÆ®ÀÇ ÀÀ¿ëÇÁ·Î±×·¥ ½ÇÇàÀ» ¿ëÀÌÇÏ°Ô ÇÏ´Â ½ºÅ©¸³Æ®)

Ãß°¡ÀûÀ¸·Î ÀÌ ¹®¼­¿¡ Æ÷ÇԵǾîÀÖ´Â `print' ½ºÅ©¸³Æ®´Â smbprint ½ºÅ©¸³Æ® ÀÛ¾÷À» ÁغñÇϴµ¥ À¯¿ëÇÏ´Ù.

»ï¹Ù ÆÐÅ°Áö´Â ¼³Ä¡ÇϱⰡ °£´ÜÇÏ´Ù. À§¿¡¼­ ¾ð±ÞÇÑ »çÀÌÆ®¿¡¼­ »ï¹Ù ¼Ò½º¸¦ ¾òÀº ´ÙÀ½¿¡ ¼Ò½º¿¡ Æ÷ÇÔµÈ README È­ÀÏÀ» Àо¾Æ¶ó. ¼Ò½º¿¡ doc/INSTALL.txtÈ­ÀÏÀÌ ÀÖÀ» °ÍÀÌ´Ù. ÀÌ È­ÀÏ¿¡¼­ ¼³Ä¡¿¡ ´ëÇÑ ÀÚ¼¼ÇÑ Á¤º¸¸¦ ¾òÀ» ¼ö ÀÖÀ» °ÍÀÌ´Ù.

ÀνºÅçÀÌ µÇ¸é /usr/sbin ¾Æ·¡¿¡ µ¥¸ó, /usr/bin ¾Æ·¡¿¡ ½ÇÇàÈ­ÀÏÀÌ ¼³Ä¡µÈ´Ù. ¸Å´º¾ó ÆäÀÌÁö´Â /usr/local/man¿¡ ¼³Ä¡µÈ´Ù.

»ï¹Ù ÆÐÅ°Áö¸¦ ¼³Ä¡ÇÒ ¶§ Makefile¿¡¼­ »ï¹Ù ¼³Á¤È­ÀÏÀÎ smb.conf È­ÀÏÀÇ À§Ä¡¸¦ ÁöÁ¤ÇØ¾ß ÇÑ´Ù. /etc ¾Æ·¡·Î ÇÏ´Â °ÍÀÌ ÀϹÝÀûÀÌÁö¸¸ ¿øÇÑ´Ù¸é ¾î¶² °÷ÀÌµç °¡´ÉÇÏ´Ù. ¿©±â¿¡¼­´Â »ï¹Ù¼³Á¤È­ÀÏÀ» /etc/smb.conf·Î, ·Î±×È­ÀÏÀÇ À§Ä¡´Â log file = /var/log/samba-log.%m, Àá±Ý µð·ºÅ丮´Â lock directory = /var/lock/samba·Î ÁöÁ¤ÇÑ °ÍÀ¸·Î °¡Á¤ÇÏ°í ¼³¸íÇÒ °ÍÀÌ´Ù.

smb.conf ¼³Á¤È­ÀÏÀ» ÀνºÅçÇÏÀÚ. ÀÌ¹Ì ¸¸µé¾îÁø »ï¹Ù µð·ºÅ丮·Î À̵¿Ç϶ó. example/simple µð·ºÅ丮¸¦ »ìÆ캸°í README È­ÀÏÀ» ÀÐ¾î º¸¾Æ¶ó. smb.conf È­ÀÏÀ» /etc µð·ºÅ丮¿¡ º¹»çÇÑ´Ù. À̶§ ÁÖÀǸ¦ ÇØ¾ß ÇÑ´Ù. ¸¸¾à ÀÌ¹Ì ½Ã½ºÅÛ¿¡ »ï¹Ù°¡ ¼³Ä¡µÇ¾î ÀÖ´Ù¸é /etc ¾Æ·¡¿¡ »ï¹Ù¼³Á¤ È­ÀÏÀÌ ÀÖÀ» ÅÙµ¥ ±× È­ÀÏ·Î ½ÃÀÛÇϱ⸦ ±ÇÇÑ´Ù.

/etc ¾Æ·¡¿¡ ¼³Á¤È­ÀÏÀ» ¸¸µå´Â °ÍÀ» ¿øÇÏÁö ¾ÊÀ¸¸é ´Ù¸¥ °÷¿¡ ÀúÀåÀ» ÇÏ°í /etc ¾Æ·¡¿¡ ´ÙÀ½°ú °°ÀÌ ½Éº¼¸¯ ¸µÅ©¸¦ ¸¸µé¾î¶ó.


        ln -s /path/to/smb.conf /etc/smb.conf

ÃÖ±ÙÀÇ ·¡µåÇÞ ¹èÆ÷ÆÇÀ» ¼³Ä¡ÇÏ¿´´Ù¸é smb.conf È­ÀÏÀº /etc/samba µð·ºÅ丮 ¾Æ·¡¿¡ ¼³Ä¡µÇ¹Ç·Î ÀÌ°ÍÀ» »ç¿ëÇÏ¸é µÈ´Ù.

4. µ¥¸ó ½ÇÇà½ÃÅ°±â

»ï¹ÙÀÇ µÎ µ¥¸óÀº /usr/sbin/smbd ¿Í /usr/sbin/nmbd ÀÌ´Ù. »ï¹Ù µ¥¸óÀº inetd ¿¡ ÀÇÇؼ­³ª µ¶¸³µÈ °úÁ¤À¸·Î ½ÇÇàµÇ¾îÁú ¼ö ÀÖ´Ù. ¿µ±¸ÀûÀÎ È­ÀÏ ¼­¹ö·Î ¼³Ä¡¸¦ ÇÑ´Ù¸é, »ï¹Ù µ¥¸óÀÌ Áß´ÜµÇ¸é ´Ù½Ã ½ÇÇàµÉ ¼ö ÀÖµµ·Ï inetd ¿¡ ÀÇÇؼ­ ½ÇÇàµÉ °ÍÀÌ´Ù. »ï¹Ù ¼­ºñ½º¸¦ °¡²û¾¿ »ç¿ëÇϰųª ´ÜÁö ½Ã½ºÅÛ °ü¸®¿¡ ÀÌ¿ëÇϱâ À§Çؼ­¶ó¸é /etc/rc.d/init.d ½ºÅ©¸³Æ®¿¡¼­ ½ÇÇà½ÃÅ°°Å³ª Á÷Á¢ ÇÊ¿ä¿¡ µû¶ó ¼öÀÛ¾÷À¸·Î ½ÇÇà½Ãų ¼ö ÀÖ´Ù.

inetd ¿¡ÀÇÇØ µ¥¸óÀ» ½ÇÇà½ÃÅ°±â À§Çؼ­´Â ¾Æ·¡ ÁÙµéÀ» /etc/inetd.conf¿¡ Ãß°¡½ÃÄÑ¾ß ÇÑ´Ù.


    # SAMBA NetBIOS services (for PC file and print sharing)
    netbios-ssn stream tcp nowait root /usr/sbin/smbd smbd
    netbios-ns dgram udp wait root /usr/sbin/nmbd nmbd

±× ´ÙÀ½¿¡ inetd µ¥¸óÀ» ´ÙÀ½°ú °°ÀÌ Àç½ÇÇà ½ÃŲ´Ù.


    kill -HUP 1

xinetd¿¡¼­ ½ÇÇà½ÃÅ°·Á¸é ´ÙÀ½³»¿ëÀÇ ÆÄÀÏÀ» ¼³Á¤ µð·ºÅ丮¿¡ Ãß°¡ÇÏ¸é µÈ´Ù. file: netbios-ns


service netbios-ns
{
        socket_type     = dgram
        protocol        = udp
        wait            = yes
        user            = root
        group           = root
        server          = /usr/sbin/nmbd
#serverÀÇ ÁÙÀº nmbdÀÇ °æ·Î.
}

file netbios-ssn
service netbios-ssn
{
        socket_type     = stream
        protocol        = tcp
        wait            = no
        user            = root
        group           = root
        server          = /usr/sbin/smbd
#server ÁÙÀº smbdÀÇ °æ·Î.
} 

½Ã½ºÅÛ Ãʱ⠽ÇÇà ½ºÅ©¸³Æ®¿¡¼­ µ¥¸óÀ» ½ÇÇà½ÃÅ°±â À§Çؼ­´Â ¾Æ·¡ÀÇ ½ºÅ©¸³Æ®¸¦ /etc/rc.d/init.d/smb ·Î ÀúÀåÀ» ÇÏ°í ÁÖ¼®¿¡ ³ª¿ÍÀִµ¥·Î ½Éº¼¸¯ ¸µÅ©¸¦ ÇؾßÇÑ´Ù. Âü°í·Î ·¡µåÇÞ µîÀÇ ¹èÆ÷ÆÇ¿¡´Â »ï¹Ù ÆÐÅ°Áö ¼³Ä¡¿Í ÇÔ²² Ãʱ⠽ÇÇà ½ºÅ©¸³Æ®°¡ ±âº»ÀûÀ¸·Î ¼³Ä¡µÇ¹Ç·Î ±×°ÍÀ» »ç¿ëÇÏ¸é µÈ´Ù.


    #!/bin/sh

    #
    # /etc/rc.d/init.d/smb - »ï¹Ù ¼­ºñ½º¸¦ ½ÃÀÛ, ÁßÁöÇÑ´Ù.
    #
    # ¾Æ·¡¿Í °°ÀÌ ÀÌ È­ÀÏÀ» ½Éº¼¸¯ ¸µÅ©¸¦ ½ÃŲ´Ù.
    # symlinks: /etc/rc.d/rc1.d/K35smb  (Kills SMB services on shutdown)
    #           /etc/rc.d/rc3.d/S91smb  (Starts SMB services in multiuser mode)
    #           /etc/rc.d/rc6.d/K35smb  (Kills SMB services on reboot)
    #

    # ÇÔ¼ö ¶óÀ̺귯¸® ¼Ò½º
    . /etc/rc.d/init.d/functions

    # ³×Æ®¿öÅ© ¼³Á¤ ¼Ò½º
    . /etc/sysconfig/network

    # ³×Æ®¿öÅ© °¡´É»óŸ¦ Á¡°ËÇÑ´Ù
    [ ${NETWORKING} = "no" ] && exit 0

    # ¼­ºñ½º¸¦ ½ÃÀÛ ¶Ç´Â ÁßÁö½ÃŲ´Ù.
    case "$1" in
      start)
        echo -n "Starting SMB services: "
        daemon smbd -D  
        daemon nmbd -D 
        echo
        touch /var/lock/subsys/smb
        ;;
      stop)
        echo -n "Shutting down SMB services: "
        killproc smbd
        killproc nmbd
        rm -f /var/lock/subsys/smb
        echo ""
        ;;
      *)
        echo "Usage: smb {start|stop}"
        exit 1
    esac

5. ÀϹÝÀûÀÎ ¼³Á¤(/etc/smb.conf ¶Ç´Â /etc/samba/smb.conf)

¸®´ª½º(¶Ç´Â ´Ù¸¥ À¯´Ð½º ½Ã½ºÅÛ)¿¡¼­ »ï¹Ù¼³Á¤Àº /etc/smb.conf (¶Ç´Â /etc/samba/smb.conf) È­ÀÏ¿¡ ÀÇÇؼ­ Á¦¾îµÈ´Ù. ÀÌ ¼³Á¤È­ÀÏÀº ¿ÜºÎ¿Í °øÀ¯½Ãų ½Ã½ºÅÛ ÀÚ¿ø°ú ¾î¶² Á¦¾àÀ» µÑ °ÍÀÎÁö¸¦ °áÁ¤ÇÑ´Ù.

ÀÌ Àý¿¡¼­ ¸®´ª½º µå¶óÀ̺ê¿Í ÇÁ¸°Å͸¦ M$¿Í °øÀ¯½ÃÅ°´Â °ÍÀ» ¼³¸íÇÒ °ÍÀÌ´Ù. À̹ø ÀýÀÇ smb.conf È­ÀÏÀº ´ÜÁö ¼Ò°³¸¦ À§ÇÑ °ÍÀ¸·Î¼­ ¾ÆÁÖ °£´ÜÇÏ´Ù. »ó¼¼ÇÑ °Íµé¿¡ ´ëÇØ ¹ú½áºÎÅÍ °ÆÁ¤ÇÒ ÇÊ¿ä´Â ¾ø´Ù. ÃßÈÄ Àý¿¡¼­ Áß¿äÇÑ °³³äµéÀ» ¼Ò°³ÇÒ °ÍÀÌ´Ù.

°¢ ¿µ¿ªÀº [global], [homes], [printer], µîÀ¸·Î ¸»¸Ó¸®°¡ ½ÃÀ۵ȴÙ.

[global] ¿µ¿ª¿¡¼­´Â »ï¹Ù°¡ ¸ðµç ÀÚ¿øµéÀÇ °øÀ¯¸¦ Á¤ÀÇÇϴµ¥ »ç¿ëÇÏ´Â ¸î¸î º¯¼öµéÀ» Á¤ÀÇÇÑ´Ù.

[homes] ¿µ¿ª¿¡¼­´Â »ç¿ëÀÚ°¡ ¿ø°ÝÀ¸·Î ¸®´ª½ºÀÇ »ç¿ëÀÚ È¨ µð·ºÅ丮·Î Á¢¼ÓÇÏ´Â °ÍÀ» Çã¿ëÇÑ´Ù. ´Ü, »ç¿ëÀÚ´Â ÀÚ½ÅÀÇ È¨ µð·ºÅ丮 Á¢¼Ó¸¸À» Çã¿ëÇÑ´Ù. Áï, M$ÀÇ »ç¿ëÀÚ°¡ M$·ÎºÎÅÍ ¸®´ª½ºÀÇ °øÀ¯ µå¶óÀ̺ê·Î Á¢¼ÓÀ» ½ÃµµÇÑ´Ù¸é, ¿ÀÁ÷ »ç¿ëÀÚ °³ÀÎÀÇ È¨ µð·ºÅ丮¸¸ÀÌ Á¢¼ÓÀÌ °¡´ÉÇÏ´Ù. À̶§ Áß¿äÇÑ °ÍÀº »ç¿ëÀÚ´Â ¸®´ª½º¿¡ °èÁ¤À» °¡Áö°í ÀÖ¾î¾ß¸¸ ÇÑ´Ù.

¾Æ·¡ÀÇ smb.conf ¿¹Á¦ È­ÀÏÀº »ç¿ëÀÚ°¡ ·ÎÄà ÄÄÇ»ÅÍÀÇ °³ÀΠȨ µð·ºÅ丮 Á¢¼Ó°ú Àӽà µð·ºÅ丮 »ý¼ºÀ» Çã¶ôÇÑ´Ù. M$ »ç¿ëÀÚ°¡ ÀÌµé °øÀ¯¸¦ º¼ ¼ö ÀÖ±âÀ§Çؼ­´Â ¸®´ª½º°¡ ·ÎÄà ³×Æ®¿öÅ© »ó¿¡ ÀÖ¾î¾ß ÇÑ´Ù. ±×·¯¸é »ç¿ëÀÚ´Â À©µµ¿ìÁî È­ÀÏ ¸Å´ÏÀú³ª Ž»ö±âÀÇ ³×Æ®¿öÅ© µå¶óÀ̺ê·Î °£´ÜÈ÷ ¿¬°áÇÒ ¼ö ÀÖ´Ù.

´õ ¸¹Àº ÀÚ¿øµéÀ» °øÀ¯½ÃÅ°±â À§ÇÑ Ãß°¡ÀûÀÎ Ç׸ñµéÀ» ´ÙÀ½ Àý¿¡¼­ ¼³¸íÇÑ´Ù.


; /etc/smb.conf
;
; ÀÌ È­ÀÏÀ» ¼öÁ¤ÇÑ µÚ¿¡ ¼­ºñ½º¸¦ ²À Àç½ÇÇàÇÑ´Ù. ¿¹:
; /etc/rc.d/init.d/smb stop
; /etc/rc.d/init.d/smb start

[global]
; guest °èÁ¤À» Çã¿ëÇÏ·Á¸é ¾Æ·¡ ÁÖ¼® ±âÈ£¸¦ »èÁ¦ÇÑ´Ù.
; guest account = nobody
   log file = /var/log/samba-log.%m
   lock directory = /var/lock/samba
   share modes = yes

[homes]
   comment = Home Directories
   browseable = no
   read only = no
   create mode = 0750

[tmp]
   comment = Temporary file space
   path = /tmp
   read only = no
   public = yes

Ȩµð·ºÅ丮¸¦ Á¢±ÙÇÒ ¼ö ÀÖ°Ô ¼³Á¤ÇÑ °æ¿ì Á¢±ÙÇÏ·Á°í Çϸé user°¡ ¾ø´Ù°í ¾ÈµÉ °ÍÀÌ´Ù smbpasswd·Î »ç¿ëÀÚ¸¦ ¸¸µé°í Æнº¿öµå¸¦ ¼³Á¤ÇØÁÖ¾î¾ß Çϴµ¥, ÀÌ ¶§ smbpasswd·Î´Â user »ý¼ºÀÌ ¾ÈµÇ°í ±âÁ¸¿¡ ÀÖ´Â »ç¿ëÀÚÀÇ Æнº¿öµå¸¸ ¹Ù²Ù¾îÁØ´Ù. smbpasswd -a ·Î ÇÏ¸é »ç¿ëÀÚ°¡ ¾ø´Â °æ¿ì »õ·Î ¸¸µé±â ¶§¹®¿¡ óÀ½¿¡ ¼³Ä¡ ÈÄ¿¡´Â smbpasswd -a·Î »ç¿ëÀÚ¸¦ Ãß°¡ÇÏÀÚ. »ç¿ëÀÚ À̸§Àº ±âÁ¸ÀÇ »ç¿ëÀÚ À̸§À» ±×´ë·Î ¾²¸é µÈ´Ù.

6. ¸®´ª½º µå¶óÀ̺긦 M$¿Í °øÀ¯½ÃÅ°±â

¾ÕÀÇ °£´ÜÇÑ smb.conf¿¡¼­¿Í °°ÀÌ M$ »ç¿ëÀÚ¿¡°Ô ¸®´ª½º µå¶óÀ̺긦 °øÀ¯½ÃÅ°±â´Â ½±´Ù. ¾î¶µç, »ï¹ÙÀÇ ¿©·¯ °¡Áö ÀÚ¿øÀ» °ü¸®ÇÏ´Â ¹æ¹ýµéÀ» ¸î°¡Áö ¿¹¸¦ µé¾î ¼³¸íÇÏ°Ú´Ù.

µð·ºÅ丮¸¦ °ø¿ëÀ¸·Î °øÀ¯½ÃÅ°±â À§Çؼ­´Â ¾ÕÀÇ smb.confÈ­ÀÏ [tmp] ¿µ¿ªÀ» º¹»çÇؼ­ ¾Æ·¡¿Í °°ÀÌ ¹Ù²Û ´ÙÀ½ È­ÀÏ¿¡ Ãß°¡ÇÑ´Ù.


[public]
   comment = Public Stuff
   path = /home/public
   public = yes
   writable = yes
   printable = yes

À§ÀÇ µð·ºÅ丮¸¦ staff ±×·ì¿¡ ¼ÓÇÑ »ç¿ëÀÚ¿¡°Ô¸¸ ¾²±â ±ÇÇÑÀ» ÁÖ°í ±×¿Ü ÀÏ¹Ý »ç¿ëÀÚ¿¡°Ô´Â Àб⠱ÇÇÑ ¸¸À» ÁÖ±âÀ§Çؼ­´Â ¾Æ·¡¿Í °°ÀÌ ¼öÁ¤ÇÑ´Ù.


[public]
   comment = Public Stuff
   path = /home/public
   public = yes
   writable = yes
   printable = no
   write list = @staff

µå¶óÀÌºê °øÀ¯¿¡ ´ëÇÑ ¶Ç´Ù¸¥ ¹æ¹ýµéÀº »ï¹Ù ¹®¼­³ª ¸Å´º¾ó ÆäÀÌÁö¸¦ º¸±â ¹Ù¶õ´Ù.

7. M$ÀÇ µå¶óÀ̺긦 ¸®´ª½º¿Í °øÀ¯½ÃÅ°±â

À¯´Ð½º¸¦ À§ÇÑ »ï¹Ù Ŭ¶óÀ̾ðÆ® ÇÁ·Î±×·¥Àº »ï¹Ù ¼Ò½º¿¡ Æ÷ÇԵǾî ÀÖ´Ù. ÀÌ °ÍÀº ÄÚ¸Çµå ¶óÀο¡¼­ ftp¿Í °°Àº ÀÎÅÍÆäÀ̽º¸¦ Á¦°øÇÑ´Ù. ÀÌ°ÍÀ» M$ ¼­¹ö¿Í ¸®´ª½º Ŭ¶óÀ̾ðÆ® °£¿¡ È­ÀÏ Àü¼Û À¯Æ¿¸®Æ¼·Î »ç¿ëÇÒ ¼ö ÀÖ´Ù.

¿øÇϴ ȣ½ºÆ®ÀÇ »ç¿ë°¡´ÉÇÑ °øÀ¯¸¦ È®ÀÎÇϱâ À§Çؼ­´Â ´ÙÀ½ ¸í·ÉÀ» ½ÇÇàÇØ º¸¾Æ¶ó.


    /usr/sbin/smbclient -L host

`host'´Â »ìÆ캸±â¸¦ ¿øÇÏ´Â ÄÄÇ»ÅÍÀÇ À̸§ÀÌ´Ù. ÀÌ ¸í·ÉÀº »ç¿ë °¡´ÉÇÑ `¼­ºñ½º'ÀÇ À̸§À» º¸¿©ÁÙ °ÍÀÌ´Ù. Áï, °øÀ¯ÇÒ ¼ö ÀÖ´Â µå¶óÀ̺곪 ÇÁ¸°ÅÍÀÇ À̸§µéÀ» º¸¿©ÁØ´Ù. »ï¹Ù ¼­¹ö°¡ ¾ÏÈ£ ¼³Á¤ÀÌ µÇ¾îÀÖ´Ù¸é ¾ÏÈ£¸¦ ¹°¾îº¼ °ÍÀÌ´Ù. ¼­¹öÀÇ `guest' °èÁ¤À̳ª »ç¿ëÀÚ °èÁ¤ÀÇ ¾ÏÈ£¸¦ ¾Ë°í ÀÖ¾î¾ß ÇÑ´Ù.

¿¹:


    smbclient -L zimmerman

ÀÌ ¸í·ÉÀÇ °á°ú´Â ´ÙÀ½ ó·³ ³ªÅ¸³¯ °ÍÀÌ´Ù.


Server time is Sat Aug 10 15:58:27 1996
Timezone is UTC+10.0
Password: 
Domain=[WORKGROUP] OS=[Windows NT 3.51] Server=[NT LAN Manager 3.51]

Server=[ZIMMERMAN] User=[] Workgroup=[WORKGROUP] Domain=[]

        Sharename      Type      Comment
        ---------      ----      -------
        ADMIN$         Disk      Remote Admin
        public         Disk      Public 
        C$             Disk      Default share
        IPC$           IPC       Remote IPC
        OReilly        Printer   OReilly
        print$         Disk      Printer Drivers


ÀÌ ÄÄÇ»ÅÍ´Â ´ÙÀ½°ú °°Àº ºê¶ó¿ìÁî(browse) ¸ñ·ÏÀ» °¡Áö°í ÀÖ´Ù.

        Server               Comment
        ---------            -------
        HOPPER               Samba 1.9.15p8
        KERNIGAN             Samba 1.9.15p8
        LOVELACE             Samba 1.9.15p8
        RITCHIE              Samba 1.9.15p8
        ZIMMERMAN            

ÀÌ ºê¶ó¿ìÁî ¸ñ·ÏÀº ¿¬°áµÈ ³×Æ®¿÷ »ó¿¡ °øÀ¯µÈ ÀÚ¿øÀ» °¡Áø »ï¹Ù ¼­¹öµéÀ» º¸¿©ÁØ´Ù.

Ŭ¶óÀ̾ðÆ®¸¦ »ç¿ëÇϱâ À§Çؼ­´Â ´ÙÀ½°ú °°ÀÌ ÇÑ´Ù.


    /usr/sbin/smbclient service <password>

`service'´Â ÄÄÇ»ÅÍ¿Í °øÀ¯¸íÀÌ´Ù. ¿¹¸¦ µé¾î `zimmerman' ÄÄÇ»ÅÍÀÇ `public'À¸·Î °øÀ¯µÈ µð·ºÅ丮¸¦ »ç¿ëÇϱâ À§Çؼ­´Â, service°¡ \\zimmerman\public À¸·Î µÈ´Ù. ±×·±µ¥ ½©ÀÇ Á¦¾à¶§¹®¿¡ ¿ª½½·¡½¬ »ç¿ë¿¡ ¾à°£ÀÇ ¹®Á¦°¡ ÀÖ´Ù. ±×·¡¼­ ´ÙÀ½°ú °°ÀÌ ÇØ¾ß ÇÑ´Ù.


    /usr/sbin/smbclient \\\\zimmerman\\public mypasswd

`mypasswd'´Â ÀÚ½ÅÀÇ ¾ÏÈ£ÀÌ´Ù.

¼º°øÇÏ¸é ´ÙÀ½°ú °°Àº smbclient ÇÁ·ÒÇÁÆ®°¡ ³ªÅ¸³­´Ù.


Server time is Sat Aug 10 15:58:44 1996
Timezone is UTC+10.0
Domain=[WORKGROUP] OS=[Windows NT 3.51] Server=[NT LAN Manager 3.51]
smb: \> 

`h'¸¦ Ä¡¸é smbclient µµ¿ò¸»À» º¼ ¼ö ÀÖ´Ù.


smb: \> h
ls             dir            lcd            cd             pwd            
get            mget           put            mput           rename         
more           mask           del            rm             mkdir          
md             rmdir          rd             prompt         recurse        
translate      lowercase      print          printmode      queue          
cancel         stat           quit           q              exit           
newer          archive        tar            blocksize      tarmode        
setmode        help           ?              !              
smb: \> 

¸¸¾à ftp¸¦ »ç¿ëÇÒ ¼ö ÀÖ´Â »ç¿ëÀÚ¶ó¸é ¾î·Á¿ò¾øÀÌ »ç¿ëÇÒ ¼ö ÀÖ´Ù.

8. ¸®´ª½º ÇÁ¸°ÅÍ¿Í M$ °øÀ¯½ÃÅ°±â

¸®´ª½ºÀÇ ÇÁ¸°Å͸¦ M$¿Í °øÀ¯½ÃÅ°±â À§Çؼ­´Â ÇÁ¸°ÅÍ°¡ ¸®´ª½º¿¡¼­ ÀÛµ¿µÇµµ·Ï ¼³Á¤ÀÌ µÇ¾îÀÖ¾î¾ß ÇÑ´Ù´Â °ÍÀº ´ç¿¬ÇÑ °ÍÀÌ´Ù. ¸®´ª½º¿¡¼­ ÇÁ¸°Æ®°¡ °¡´ÉÇÏ´Ù¸é »ï¹Ù °øÀ¯¸¦ ¼³Á¤ÇÏ´Â °ÍÀº °£´ÜÇÑ ÀÏÀÌ´Ù.

·ÎÄà ÇÁ¸°Æ®¸¦ ¼³Á¤ÇÏ´Â ºÎºÐ¿¡ ´ëÇؼ­´Â Printing HOWTO ¹®¼­¸¦ Âü°íÇϱ⸦ ¹Ù¶õ´Ù.

ÀÌ ¹®¼­ÀÇ ÀúÀÚ´Â M$ NT¿¡ ¿¬°áµÈ ÇÁ¸°Å͸¦ »ç¿ëÇϱ⠶§¹®¿¡ ÀÌ ºÎºÐÀ» ¿ÏÀüÇÑ °ÍÀ¸·Î »ý°¢ÇÏÁö ¸»°í, ´ÜÁö Á¦¾ÈÇÏ´Â Á¤µµ·Î »ý°¢Çϱ⠹ٶõ´Ù. ¸¸¾à ¸®´ª½º ÇÁ¸°ÅÍ¿Í M$¸¦ °øÀ¯½ÃÅ°´Â ÀÚ¼¼ÇÑ ¹æ¹ýÀ» ¾Ë°í ÀÖ´Ù¸é ¸ÞÀÏ dwood@plugged.net.au À» º¸³»Áֱ⠹ٶõ´Ù. ±×°ÍÀ» Âü°í·ÎÇؼ­ ÀÌ ºÎºÐÀÌ ¿Ïº®ÇÏ°Ô µÉ ¼ö ÀÖ´Ù.

smb.conf¿¡ ÇÁ¸°Æ® ¼³Á¤À» Ãß°¡ÇÑ´Ù.


[global]
   printing = bsd
   printcap name = /etc/printcap
   load printers = yes
   log file = /var/log/samba-log.%m
   lock directory = /var/lock/samba

[printers]
   comment = All Printers
   security = server
   path = /var/spool/lpd/lp
   browseable = no
   printable = yes
   public = yes
   writable = no
   create mode = 0700

[ljet]
   security = server
   path = /var/spool/lpd/lp
   printer name = lp
   writable = yes
   public = yes
   printable = yes
   print command = lpr -r -h -P %p %s

ÇÁ¸°ÅÍÀÇ °æ·Î(ÀÌ °æ¿ì¿£ [ljet]ÀÇ path)¸¦ /etc/printcap¿¡ Á¤ÀÇµÈ ½ºÇ®µð·ºÅ丮¿Í ÀÏÄ¡½ÃÅ°´Â °ÍÀ» ÀØÁö¸»¾Æ¶ó.

ÁÖÀÇ: »ï¹Ù¸¦ ÀÌ¿ëÇØ À¯´Ð½º¿¡ ¿¬°áµÈ ÇÁ¸°ÅÍ¿Í M$ NT¸¦ °øÀ¯½ÃÅ°´Â °Í¿¡´Â ¾à°£ÀÇ ¹®Á¦°¡ ÀÖ´Ù. ¹®Á¦ÀÇ Çϳª´Â °øÀ¯µÈ ÇÁ¸°Å͸¦ NT°¡ ÀûÀýÇÏ°Ô ÀνÄÇÒ ¼ö ÀÖ´À³Ä¿¡ ´ëÇÑ °ÍÀÌ´Ù. ÀÌ ¹®Á¦¸¦ °íÄ¡±â À§Çؼ­´Â »ï¹Ù ¼Ò½º¿¡ Æ÷ÇԵǾî ÀÖ´Â docs/WinNT.txt ¹®¼­¸¦ º¸±â ¹Ù¶õ´Ù. ¶Ç´Ù¸¥ ¹®Á¦´Â ¾ÏÈ£¸¦ ó¸®ÇÏ´Â ¹®Á¦ÀÌ´Ù. À§ÀÇ ¹®¼­¸¦ »ìÆ캸¸é ÀÌ ¹®Á¦ÀÇ ¼öÁ¤¿¡ ½ÇÆÐÇÑ °ÍÀ» ÀÌÇØÇϱ⠾î·Æ°Ô ½á³õ¾Ò´Ù.

9. M$ÀÇ ÇÁ¸°Å͸¦ ¸®´ª½º¿Í °øÀ¯Çϱâ

M$ÀÇ ÇÁ¸°Å͸¦ °øÀ¯Çϱâ À§Çؼ­´Â ¾Æ·¡ÀÇ ÀÛ¾÷À» ²À Çؾ߸¸ ÇÑ´Ù.

a) /etc/printcap È­ÀÏ¿¡ ·ÎÄà µð·ºÅ丮 ±¸Á¶(½ºÇ®µð·ºÅ丮 µî)¿Í Á¤È®È÷ ÀÏÄ¡ÇÏ´Â Àû´çÇÑ »çÇ×µéÀÌ ÀÖ¾î¾ß ÇÑ´Ù.

b) /usr/bin/smbprint È­ÀÏÀÌ ÀÖ¾î¾ß ÇÑ´Ù. ÀÌ È­ÀÏÀº »ï¹Ù ¼Ò½º¿¡ °°ÀÌ Æ÷ÇԵǾî Àִµ¥, »ï¹Ù ½ÇÇà È­Àϸ¸ÀÌ µé¾îÀÖ´Â ¹èÆ÷º»¿¡´Â ºüÁ®ÀÖÀ» ¼ö ÀÖ´Ù. ÀÌ È­ÀÏÀ» ¾à°£ ¼öÁ¤ÇÑ °ÍÀÌ ¾Æ·¡¿¡ ¼³¸íµÇ¾î ÀÖ´Ù.

c) ¸¸¾à ¾Æ½ºÅ° È­ÀÏÀ» Æ÷½ºÆ®½ºÅ©¸³Æ® È­ÀÏ·Î º¯È¯Çϱâ À§Çؼ­´Â nenscript³ª ±×¿Í °°Àº ¿ªÇÒÀ» ÇÏ´Â °ÍÀ» °¡Áö°í ÀÖ¾î¾ß¸¸ ÇÑ´Ù. nenscript´Â Æ÷½ºÆ®½ºÅ©¸³Æ® º¯È¯±âÀÌ°í º¸ÅëÀº /usr/bin ¾Æ·¡¿¡ ¼³Ä¡µÈ´Ù.

d) »ï¹Ù·Î ÇÁ¸°ÆÃÇÒ¶§ »ç¿ëÇϱâ ÆíÇÑ µµ±¸¸¦ ÀÌ¿ëÇϱ⸦ ¿øÇÒ °ÍÀÌ´Ù. ¾Æ½ºÅ° È­ÀÏ, Æ÷½ºÆ®½ºÅ©¸³Æ® È­ÀÏÀ» ó¸®ÇØÁÖ´Â, ¶Ç´Â Æ÷½ºÆ®½ºÅ©¸³Æ® È­ÀÏÀ» »ý¼ºÇØÁÖ´Â ÆÞ ½ºÅ©¸³Æ®°¡ ¾Æ·¡¿¡ ÁÖ¾îÁ® ÀÖ´Ù.

M$ NT È£½ºÆ®ÀÇ HP 5MP ÇÁ¸°Å͸¦ À§ÇÑ /etc/printcap È­ÀÏÀÇ ¼³Á¤ÀÌ ¾Æ·¡¿¡ ÁÖ¾îÁ® ÀÖ´Ù. °¢ Ç׸ñµéÀº ´ÙÀ½ÀÇ Àǹ̰¡ ÀÖ´Ù


        cm - ÁÖ¼®(ÇÁ¸°ÅÍ ¼³¸í)
        lp - Ãâ·ÂÀ» À§ÇÑ ÀåÄ¡¸í
        sd - ·ÎÄà ÄÄÇ»ÅÍÀÇ ÇÁ¸°ÅÍ ½ºÇ® µð·ºÅ丮
        af - the accounting file
        mx - ÃÖ´ë È­ÀÏ Å©±â( 0Àº Á¦ÇÑÀÌ ¾øÀ½À» ¶æÇÑ´Ù)
        if - ÀÔ·Â ÇÊÅÍ(½ºÅ©¸³Æ®)ÀÇ À̸§

´õ ¸¹Àº Á¤º¸¸¦ ¿øÇϸé Printing HOWTO³ª printcapÀÇ ¸Å´º¾óÀ» º¸±â ¹Ù¶õ´Ù


# /etc/printcap
#
# //zimmerman/oreilly via smbprint
#
lp:\
        :cm=HP 5MP Postscript OReilly on zimmerman:\
        :lp=/dev/lp1:\
        :sd=/var/spool/lpd/lp:\
        :af=/var/spool/lpd/lp/acct:\
        :mx#0:\
        :if=/usr/bin/smbprint:

½ºÇ® µð·ºÅ丮¿Í accounting µð·ºÅ丮°¡ Á¸ÀçÇÏ°í ¾²±â°¡´É ¸ðµå·Î ¼³Á¤À» ÇØÁÖ¾î¾ß ÇÑ´Ù. ¶ÇÇÑ 'if' ÁÙ¿¡ smbprint ½ºÅ©¸³Æ®(¾Æ·¡¿¡ ÁÖ¾îÁø)ÀÇ Á¤È®ÇÑ °æ·Î°¡ ÀûÇôÀÖ´ÂÁö, ÀûÀýÇÑ ÀåÄ¡¸¦ °¡¸®Å°°í ÀÖ´ÂÁö(/dev ¾Æ·¡ÀÇ Æ¯º° È­ÀÏ)¸¦ È®ÀÎÇØ¾ß ÇÑ´Ù.

´ÙÀ½À¸·Î smbprint ½ºÅ©¸³Æ®¿¡´ëÇÑ ¼³¸íÀÌ´Ù. ½ºÅ©¸³Æ®´Â ´ë°³ /usr/bin ¾Æ·¡¿¡ À§Ä¡ÇÏ°í, »ï¹Ù¸¦ ¸¸µç»ç¶÷À¸·Î ¿©°ÜÁö´Â Andrew Tridgell¿¡ ÀÇÇÑ °ÍÀÌ´Ù. ÀÌ ½ºÅ©¸³Æ®´Â »ï¹Ù¼Ò½º ¹èÆ÷º»¿¡´Â Æ÷ÇԵǾîÀÖÁö¸¸ ½ÇÇàÈ­ÀÏ ¹èÆ÷º»¿¡´Â µé¾îÀÖÁö ¾Ê´Ù. ±×·¡¼­ ¿©±â¿¡¼­ ´Ù½Ã ¸¸µé¾î º¼ °ÍÀÌ´Ù.

ÀÌ ½ºÅ©¸³Æ®¸¦ ÁÖÀDZí°Ô »ìÆ캼 °ÍÀ¸·Î ¿©°ÜÁö´Âµ¥, ÀÌ ½ºÅ©¸³Æ®¸¦ ±×³É ±×´ë·Î »ç¿ëÇÏ´Â °Íº¸´Ù´Â ÀÚ½ÅÀÇ È¯°æ¿¡ ¾Ë¸Â°Ô ¼öÁ¤ÇÏ´Â °ÍÀÌ ´õ ¹Ù¶÷Á÷ÇÏ°í À¯¿ëÇÏ´Ù.


#!/bin/sh -x

# ÀÌ ½ºÅ©¸³Æ®´Â À¯´Ð½º »ó¿¡¼­ printcap ÇÁ¸°ÆÃÀ» À§ÇÑ ÀÔ·Â ÇÊÅÍÀÌ´Ù.
# ÀÌ°ÍÀº ÁöÁ¤µÈ »ï¹Ù ¼­¹ö¿Í ¼­ºñ½º¿¡ È­ÀÏÀ» ÇÁ¸°Æ®Çϱâ À§ÇÑ smbclient
# ÇÁ·Î±×·¥À» ÀÌ¿ëÇÑ´Ù.
# ¿¹¸¦ µé¾î printcap ¼³Á¤À» ¾Æ·¡Ã³·³ ÇÒ ¼ö ÀÖ´Ù
#
# smb:lp=/dev/null:sd=/usr/spool/smb:sh:if=/usr/local/samba/smbprint
#
# À§ÀÇ ¼³Á¤Àº ÀÌ ½ºÅ©¸³Æ®¸¦ ÅëÇØ ÇÁ¸°Æ®ÇÏ´Â "smb" ¶ó´Â À¯´Ð½º ÇÁ¸°Å͸¦
# ¸¸µç´Ù. ¶ÇÇÑ ÀûÀýÇÑ ±ÇÇÑ°ú ¼ÒÀ¯±ÇÀ» °¡Áø /usr/spool/smb ½ºÇ®µð·ºÅ丮¸¦
# ¸¸µé¾î¾ß ÇÑ´Ù.

#
# ½ºÅ©¸³Æ®´Â hamiltom@ecnz.co.nz (Michael Hamilton)¿¡ ÀÇÇؼ­ ¼­¹ö, ¼­ºñ½º
# ±×¸®°í ¾ÏÈ£¸¦ /usr/var/spool/lpd/PRINTNAME/.config È­ÀÏ¿¡¼­ ÀÐÀ» ¼ö
# ÀÖµµ·Ï ¹Ù²î¾îÁ³´Ù.
#
# ÀÌ°ÍÀ» °¡´ÉÇÏ°Ô Çϱâ À§Çؼ­´Â /etc/printcap¿¡ accounting È­ÀÏ(af=...)ÀÌ ²À
# Æ÷ÇԵǾî¾ß¸¸ ÇÑ´Ù.
#
#   cdcolour:\
#       :cm=CD IBM Colorjet on 6th:\
#       :sd=/var/spool/lpd/cdcolour:\
#       :af=/var/spool/lpd/cdcolour/acct:\
#       :if=/usr/local/etc/smbprint:\
#       :mx=0:\
#       :lp=/dev/null:
#
# /usr/var/spool/lpd/PRINTNAME/.config È­ÀÏ¿¡ ´ÙÀ½ »çÇ×µéÀ» Æ÷ÇÔÇÑ´Ù:
#   server=PC_SERVER
#   service=PR_SHARENAME
#   password="password"
#
# E.g.
#   server=PAULS_PC
#   service=CJET_371
#   password=""

#
# Debugging log file, ¿øÇÑ´Ù¸é /dev/null·Î ¹Ù²ãµµ µÈ´Ù.
#
logfile=/tmp/smb-print.log
# logfile=/dev/null


#
# ÇÊÅÍÀÇ ¸¶Áö¸· ÆĶó¹ÌÅÍ´Â accounting È­ÀÏ À̸§ÀÌ´Ù.
#
spool_dir=/var/spool/lpd/lp
config_file=$spool_dir/.config

# config È­ÀÏ¿¡¼­ ´ÙÀ½ º¯¼ö ¼³Á¤À» ÀÐ¾î µéÀδÙ.
#   server
#   service
#   password
#   user
eval `cat $config_file`

#
# Some debugging help, change the >> to > if you want to same space.
#
echo "server $server, service $service" >> $logfile

(
# ÁÖÀÇ: ÇÁ¸°Æ®½Ã¿¡ ÀÚµ¿À¸·Î CR/LF º¯È¯À» °¡´ÉÇÏ°Ô ÇÏ·Á¸é `echo translate'¸¦
# Ãß°¡ÇÑ´Ù.
  echo translate
        echo "print -"
        cat
) | /usr/bin/smbclient "\\\\$server\\$service" $password -U $user -N -P >> $logfile

´ëºÎºÐÀÇ ¸®´ª½º ¹èÆ÷ÆÇÀº ¾Æ½ºÅ° ¹®¼­¸¦ Æ÷½ºÆ®½ºÅ©¸³Æ®·Î º¯È¯ÇØÁÖ´Â nenscript¸¦ °¡Áö°í ÀÖ´Ù. ´ÙÀ½ perl ½ºÅ©¸³Æ®´Â smbprint¸¦ ÅëÇØ ¸®´ª½º¿¡¼­ ÇÁ¸°Æ®ÇÏ´Â °ÍÀ» ¾ÆÁÖ ½±°Ô ÇØÁØ´Ù.


Usage: print [-a|c|p] <filename>
       -a prints <filename> as ASCII
       -c prints <filename> formatted as source code
       -p prints <filename> as Postscript
        If no switch is given, print attempts to
        guess the file type and print appropriately.

¾Æ½ºÅ° È­ÀÏÀ» ÇÁ¸°Æ®Çϱâ À§Çؼ­ smbprint¸¦ ÀÌ¿ëÇÒ¶§ ±ä ÁÙÀº À߸®´Â °æ¿ì°¡ ÀÖ´Ù. ÀÌ ½ºÅ©¸³Æ®´Â °¡´ÉÇÏ´Ù¸é ±ä ÁÙÀÌ ´Ü¾î Áß°£ÀÌ À߸®´Â ´ë½Å¿¡ °ø¹é¿¡¼­ À߸®µµ·Ï ÇØÁØ´Ù.

nenscript´Â ¼Ò½ºÄڵ忡 Çü½ÄÀ» ÁØ´Ù. Àå½ÄÀûÀÎ ¸Ó¸´¸»(³¯Â¥, È­ÀÏÀ̸§ µî)À» Ãß°¡ÇÏ¿© ¾Æ½ºÅ° È­ÀÏ°ú Çü½ÄÀ» »ý¼ºÇÑ´Ù. ¶ÇÇÑ, ÁÙ¹øÈ£¸¦ ¸Å±ä´Ù. ¾Æ·¡ ¿¹¸¦ ÀÌ¿ëÇÏ¿© ´Ù¸¥ ¸ð¾çÀÇ Çü½Äµµ °¡´ÉÇÏ´Ù.

Æ÷½ºÆ®½ºÅ©¸³Æ® ¹®¼­´Â ÀÌ¹Ì ÀûÀýÇÑ Çü½ÄÀ» °¡Áö°í ÀÖÀ¸¹Ç·Î Á÷Á¢ Ãâ·ÂÀÌ µÈ´Ù.


#!/usr/bin/perl

# Script:   print
# Authors:  Brad Marshall, David Wood
#           Plugged In Communications
# Date:     960808
#
# Script to print to oreilly which is currently on zimmerman
# ¸ñÀû: ¿©·¯°¡Áö Çü½ÄÀÇ È­ÀϵéÀ» ÀÎÀڷμ­ ¹Þ¾Æµé¿© »ï¹Ù ÇÁ¸°Æ® ½ºÅ©¸³Æ®¿¡
# ÆÄÀÌÇÁ·Î º¸³»´Âµ¥ Àû´çÇÏ°Ô Ã³¸®¸¦ ÇÑ´Ù.
#
# °¡´ÉÇÑ È­ÀÏ Çü½Ä:
# 
# ASCII      - $line_length º¸´Ù ´õ ±ä ±ÛÀÚµéÀ» °ø¹éÀ¸·Î ÁÙ ±æÀ̸¦ Á¶Á¤ÇÑ´Ù. 
# Postscript - ¾Æ¹«·± 󸮵µ ÇÏÁö ¾Ê´Â´Ù.
# Code       - Àû´çÇÏ°Ô(Ãâ·Â¹æÇâ, ±ÛÀÚ¸ð¾ç µî) Ãâ·ÂÇϱâ À§Çؼ­ nenscript¸¦
#                                                ÀÌ¿ëÇÏ¿© Æ÷½ºÆ®½ºÅ©¸³Æ® ¹®¼­·Î ¸¸µç´Ù.
#

# ¾Æ½ºÅ° ÅؽºÆ® ¹®¼­¿¡¼­ ÇÑ ÁÙ´ç ÃÖ´ë ±ÛÀÚ¼ö.
$line_length = 76;

# »ï¹Ù ÇÁ¸°Æ® ½ºÅ©¸³Æ®ÀÇ °æ·Î¿Í À̸§.
$print_prog = "/usr/bin/smbprint";

# nenscriptÀÇ °æ·Î¿Í À̸§(¾Æ½ºÅ°-->Æ÷½ºÆ®½ºÅ©¸³Æ® º¯È¯±â)
$nenscript = "/usr/bin/nenscript";

unless ( -f $print_prog ) {
        die "Can't find $print_prog!";
}
unless ( -f $nenscript ) {
        die "Can't find $nenscript!";
}

&ParseCmdLine(@ARGV);

# DBG
print "filetype is $filetype\n";

if ($filetype eq "ASCII") {
        &wrap($line_length);
} elsif ($filetype eq "code") {
        &codeformat;
} elsif ($filetype eq "ps") {
        &createarray;
} else {
        print "Sorry..no known file type.\n";
        exit 0;
}
# smbprint·Î °¢ ÁÙµéÀ» ¿¬°á(Ãâ·Â)½ÃŲ´Ù.
open(PRINTER, "|$print_prog") || die "Can't open $print_prog: $!\n";
foreach $line (@newlines) {
        print PRINTER $line;
}
# È­ÀÏÀÇ ¸¶Áö¸· ÁÙÀÌ Á¦´ë·Î ³¡³ªÁö ¾ÊÀº °æ¿ì¿¡ ÁٹٲÞ(¶óÀÎÇǵå)¸¦ Ãß°¡ÇÑ´Ù.
print PRINTER "\n";
close(PRINTER);
print "Completed\n";
exit 0;

# --------------------------------------------------- #
#        Everything below here is a subroutine        #
# --------------------------------------------------- #

sub ParseCmdLine {
        # ÄÚ¸Çµå ¶óÀÎÀ» ºÐ¼®Çؼ­ È­ÀÏÀÇ Çü½ÄÀÌ ¹«¾ùÀÎÁö ã¾Æ³½´Ù.

        # $arg¿Í $file ÀÌ ÀÖ´Ù¸é °ªÀ» ¾ò´Â´Ù. 
        # and the filename
        if ($#_ < 0) {
                &usage;
        }
        # DBG
#       foreach $element (@_) {
#               print "*$element* \n";
#       }

        $arg = shift(@_);
        if ($arg =~ /\-./) {
                $cmd = $arg;
        # DBG
#       print "\$cmd found.\n";

                $file = shift(@_);
        } else {
                $file = $arg;
        }
        
        # È­ÀÏ Çü½ÄÀ» Á¤ÀÇÇÑ´Ù.
        unless ($cmd) {
                # ¾Æ¹«·± ÀÎÀÚ°¡ ¾øÀ» °æ¿ì.

                if ($file =~ /\.ps$/) {
                        $filetype = "ps";
                } elsif ($file =~ /\.java$|\.c$|\.h$|\.pl$|\.sh$|\.csh$|\.m4$|\.inc$|\.html$|\.htm$/) {
                        $filetype = "code";
                } else {
                        $filetype = "ASCII";
                }

                # $fileÀÇ È­ÀÏÇü½ÄÀÌ ¹«¾ùÀÎÁö ¾Ë¾Æ³»¼­ $filetypeÀ» ³Ñ°ÜÁØ´Ù. 
        } else {
                # We have what type it is in $arg
                if ($cmd =~ /^-p$/) {
                        $filetype = "ps";
                } elsif ($cmd =~ /^-c$/) {
                        $filetype = "code";
                } elsif ($cmd =~ /^-a$/) {
                        $filetype = "ASCII"
                }
        }
}

sub usage {
        print "
Usage: print [-a|c|p] <filename>
       -a prints <filename> as ASCII
       -c prints <filename> formatted as source code
       -p prints <filename> as Postscript
        If no switch is given, print attempts to
        guess the file type and print appropriately.\n
";
        exit(0);
}

sub wrap {
        # ÁÙ±æÀÌ°¡ ÁöÁ¤µÈ ±ÛÀÚ¼öº¸´Ù Àûµµ·Ï È­ÀÏÀÇ °¢ ÁÙÀ» ¹è¿­¿¡ ÇÒ´çÇÑ´Ù.
        # °ø¹éÀ» ÀÌ¿ëÇØ ÁÙ±æÀ̸¦ Á¶Á¤ÇÑ´Ù.

        # ÁÙ±æÀ̸¦ Á¦ÇÑÇÒ ±ÛÀÚ¼öÀÇ °ªÀ» ¾ò´Â´Ù. 
        $limit = pop(@_);

        # DBG
        #print "Entering subroutine wrap\n";
        #print "The line length limit is $limit\n";

        # È­ÀÏÀ» Àоîµé¿© ºÐ¼®ÇÏ°í °¢ ÁÙÀ» ¹è¿­¿¡ ÇÒ´çÇÑ´Ù.
        open(FILE, "<$file") || die "Can't open $file: $!\n";
        while(<FILE>) {
                $line = $_;
                
                # DBG
                #print "The line is:\n$line\n";

                # Á¦ÇѱæÀ̺¸´Ù ±ä ÁÙÀº ±æÀ̸¦ Á¶Á¤ÇÑ´Ù.
                while ( length($line) > $limit ) {
                        
                        # DBG
                        #print "Wrapping...";

                        # $limit +1 ±îÁöÀÇ ±ÛÀÚµéÀ» ¾ò´Â´Ù.
                        $part = substr($line,0,$limit +1);

                        # DBG
                        #print "The partial line is:\n$part\n";

                        # ¸¶Áö¸· ¹®ÀÚ°¡ °ø¹éÀÎÁö ¾Æ´ÑÁö¸¦ Á¶»çÇÑ´Ù.
                        $last_char = substr($part,-1, 1);
                        if ( " " eq $last_char ) {
                            # °ø¹éÀ̶ó¸é ±×´ë·Î Ãâ·ÂÇÑ´Ù.

                            # DBG
                            #print "The last character was a space\n";

                            substr($line,0,$limit + 1) = "";
                            substr($part,-1,1) = "";
                            push(@newlines,"$part\n");
                        } else {
                             # °ø¹éÀÌ ¾Æ´Ï¶ó¸é ¸¶Áö¸· °ø¹éÀÇ À§Ä¡¸¦
                             # ã°í ±×°÷±îÁö Ãâ·ÂÇÑ´Ù.

                            # DBG
                            #print "The last character was not a space\n";

                             # $limit ÀÌÀüÀÇ ±ÛÀÚ¸¦ Áö¿î´Ù.
                             substr($part,-1,1) = "";
                             # ¸¶Áö¸· °ø¹éÀ» ã±â ½±°Ô ÁÙÀ» µÚÁý´Â´Ù.
                             $revpart = reverse($part);
                             $index = index($revpart," ");
                             if ( $index > 0 ) {
                               substr($line,0,$limit-$index) = "";
                               push(@newlines,substr($part,0,$limit-$index) 
                                   . "\n");
                             } else {
                               # °ø¹éÀ» Æ÷ÇÔÇÏÁö ¾ÊÀº ÁÙÀ̶ó¸é
                               # $limit ±îÁö Ãâ·ÂÀ» ÇÑ´Ù.
                               substr($line,0,$limit) = "";
                               push(@newlines,substr($part,0,$limit) 
                                   . "\n");
                             }
                        }
                }
                push(@newlines,$line);
        }
        close(FILE);
}

sub codeformat {
        # ¼­ºê·çƾ wrap¸¦ È£ÃâÇؼ­ nenscript¸¦ ÅëÇÑ ÇÊÅ͸µÀ» ÇÑ´Ù. 
        &wrap($line_length);
        
        # ¼Ò½º Äڵ带 ÇÁ¸°Æ®Çϱâ À§ÇØ ¸î°¡Áö ¾Ë¸ÂÀº Çü½Äµé(¿ëÁö¹æÇâ,
        # Courier font, ÁÙ¹øÈ£)À» Æ÷ÇÔ½ÃŲ Æ÷½ºÆ®½ºÅ©¸³Æ® È­ÀÏÀ» »ý¼º
        # Çϱâ À§Çؼ­ nenscriptÀÇ °á°ú¸¦ ó¸®ÇÑ´Ù.
        # ù¹ø°·Î ÀÓ½ÃÈ­ÀÏ·Î Ãâ·ÂÇÑ´Ù.
        $tmpfile = "/tmp/nenscript$$";
        open(FILE, "|$nenscript -2G -i$file -N -p$tmpfile -r") || 
                die "Can't open nenscript: $!\n";
        foreach $line (@newlines) {
                print FILE $line;
        }
        close(FILE);
        
        # Àӽà ȭÀÏÀ» ´Ù½Ã Àоîµé¿©¼­ »ï¹Ù ÇÁ¸°Æ® ½ºÅ©¸³Æ®·Î Ãâ·ÂÇÒ
        # ¼ö ÀÖµµ·Ï ¹è¿­¿¡ ÀúÀåÇÑ´Ù.
        @newlines = ("");
        open(FILE, "<$tmpfile") || die "Can't open $file: $!\n";
        while(<FILE>) {
                push(@newlines,$_);
        }
        close(FILE);
        system("rm $tmpfile");
}

sub createarray {
        # Æ÷½ºÆ®½ºÅ©¸³Æ®¸¦ À§ÇÑ ¹è¿­À» »ý¼ºÇÑ´Ù.
        open(FILE, "<$file") || die "Can't open $file: $!\n";
        while(<FILE>) {
                push(@newlines,$_);
        }
        close(FILE);
}

10. ÀúÀÛ±Ç

This HOWTO is copyright 1996 by David Wood. It may be reproduced in any form and freely distributed as long as the file stays intact, including this statement.

11. °¨»çÀÇ ±Û

Á¦¾È »çÇ×ÀÌ ÀÖ´Ù¸é ¹Ù·Î ¸ÞÀÏÀ» º¸³»±â ¹Ù¶õ´Ù. ´ÙÀ½ °³Á¤ÆÇÀÇ ÀÌ°÷¿¡ ´ç½Å¿¡°Ô °¨»ç¸¦ Ç¥ÇÏ°Ú´Ù.


ID
Password
Join
Some men are discovered; others are found out.


sponsored by andamiro
sponsored by cdnetworks
sponsored by HP

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2003-09-15 10:31:07
Processing time 0.0020 sec