|
|
|
¸®´ª½ºÆÁ Go Unix Power Tools Online Book
Go Bash Guide
|
|
Read No. 44 article |
2001-08-29 23:52:31 |
|
|
|
|
NickName |
Ç®ºñ´© |
Subject |
samba ÇÁ¸°ÅÍ ¼³Á¤ |
|
|
SAMBA¸¦ ÀÌ¿ëÇÑ ÇÁ¸°ÅÍ ¼³Á¤
¹æ âÇöwinchild at hanimail.net
1999³â 8¿ù 17ÀÏ ver0.01
SGML ÆíÁý: ½Å µ¿¿ømailto:kaien at metal.me.pusan.ac.kr
______________________________________________________________________
¸ñÂ÷
1. SAMBA¿¡¼ LINUX ÃøÀÇ ÇÁ¸°ÅÍ ¼¼Æà °ü·Ã
2. SAMBA ¿¡¼ REMOTE-PC ÃøÀÇ ÇÁ¸°ÅÍ ¼¼Æà °ü·Ã
______________________________________________________________________
1. SAMBA¿¡¼ LINUX ÃøÀÇ ÇÁ¸°ÅÍ ¼¼Æà °ü·Ã
À¯´Ð½º¿¡¼ ÇÁ¸°Å͸¦ »ç¿ëÇÏ·Á¸é /etc/printcap ÆÄÀÏÀ» ¼³Á¤ÇØ¾ß ÇÑ´Ù.
¿¹Á¦¸¦ º¸¸é
lp|lj|HP LJ6P:\
:lp=/dev/lp0:\
:sd=/var/spool/lpd/lj:\
:mx#0:sh:sf:
°¢°¢ÀÇ ¼³¸í´Â | ·Î ±¸ºÐµÈ lp ¿Í lj Àº ÇÁ¸°ÅÍÀÇ ¸íĪÀÌ´Ù. lpr -P <name>
¿¡¼ nameÀÇ ÇÁ¸°ÅÍ ¸íÀ¸·Î ÀÌ¿ëµÈ´Ù. lp=/dev/lp0 ´Â ÇÁ¸°ÅÍ deviceÀÇ
¸íĪÀÌ´Ù. ¾î´À Æ÷Æ®¿¡ ÇÁ¸°ÅÍ°¡ ºÙ¾î ÀÖ´ÂÁö´Â
# cat /etc/hosts > /dev/lp0
¿Í °°Àº ¸®´ÙÀÌ·º¼Ç ¸í·ÉÀ¸·Î È®ÀÎÇØ º¼¼ö ÀÖ´Ù. ÀÌ°æ¿ì hostsÀÇ ÅؽºÆ®
ÆÄÀÏÀÌ ÀμâµÇ¸é ÇÁ¸°ÅÍ¿ÍÀÇ ¿¬°áÀº ÀÌ»óÀÌ ¾ø´Â°ÍÀÌ´Ù.
sd=/var/spool/lpd/lj Àº spool µð·ºÅ丮·Î¼ ÆÄÀÏÀ» ÀμâÇҽÿ¡ Àӽ÷Î
ÀúÀåÇØ ³õ´Â °ø°£ÀÌ´Ù. ÇØ´ç path ´ë·Î µð·ºÅ丮¸¦ »ý¼ºÇØ ³õ¾Æ¾ß ÇÑ´Ù.
mx#0 ´Â ÆÄÀÏÀÇ Å©±â¸¦ Á¦ÇÑÇÏÁö ¸»¶ó´Â ¿É¼ÇÀ̸ç sh´Â ´ë·®ÀÇ Ãâ·ÂÀ»
Á¦ÇÑÇÏÁö ¾Ê´Â ¿É¼ÇÀ̸ç (Windwos ¾Ö¼ »ý¼ºÇÏ´Â ÆÄÀÏÀº ´ë·®ÀÇ À̹ÌÁö
ÆÄÀÏÀ̹ǷΠÁ¦ÇÑÇÏ¸é ¾ÈµÈ´Ù.) sf ¿É¼ÇÀº ¹®¼¸¦ Ãâ·ÂÇÑÈÄ¿¡ form feed
¹®ÀÚ¸¦ º¸³»Áö ¸»¶ó´Â °ÍÀÌ´Ù. (ÀÌ°ÍÀ» ÁöÁ¤ÇØ ³õÁö ÆÄÀÏÀÇ Ãâ·Â½Ã¿¡´Â
ºóÆäÀÌÁö°¡ Çϳª¾¿ ´õ³ª°¡°Ô µÈ´Ù. ±×·¯³ª UNIXÀÇ form feed°¡ ¾ø´Â
ASCII¹®¼ Ãâ·Â½Ã¿¡´Â ÇÊ¿äÇÏ´Ù.) sh, sf ¿É¼ÇÀº ¼±¾ðµÇ¸é false °¡ µÇ´Â
¿É¼ÇÀÌ´Ù. (man printcap ÂüÁ¶)
printcap ÆÄÀÏÀÌ Á¦´ë·Î µÇ¾úÀ¸¸é lpc ¸í·ÉÀ¸·Î ÇÁ¸°Æà ¼ºñ½º°¡
±¸µ¿µÇµµ·Ï ÇÑ´Ù.
# lpc
lpc> restart all
lpc > status
lp:
queuing is enabled
printing is enabled
no entries
no daemon present
lpc>
±¸µ¿ÀÌ µÈ°ÍÀÌ È®ÀεǸé Ãâ·ÂÀÌ µÇ´ÂÁö È®ÀÎÇÑ´Ù. À̶§ sf ¿É¼ÇÀÌ false
À̹ǷΠÆ÷ÇԵǾî ÀÖÀ¸¹Ç·Î ÀÏ¹Ý ASCII ¹®¼ ¸¦ °ñ¶ó¼ ³¡¿¡ ^L (form feed)
¹®ÀÚ¸¦ »ðÀÔÇÏ¿© lpr ¸í·ÉÀ¸·Î ÂïÀÌ´ÂÁö È®ÀÎÇÑ´Ù.
# lpr -P lp /tmp/testfile
¼º°øÀûÀ¸·Î ÀμâµÇ¾úÀ¸¸é SAMBA ¸¦ ¼¼ÆÃÇÑ´Ù. ÀϹÝÀûÀÎ ¼¼Æùæ¹ýÀº ±âÁ¸¿¡
Àß ¼³¸íµÇ¾î ÀÖ´Â ¹®¼¸¦ º¸´Â°ÍÀ¸·Î »ý·«ÇÏ°í
path = /var/spool/lpd/lj
printer name = lj
print command = lpr -r -h -P %p %s
¿Í °°ÀÌ /etc/printcap ¿¡ ¼±¾ðµÈ sd ¹× prnter name ÀÌ ÀÏÄ¡Çϵµ·Ï ÇÏ¿©¾ß
ÇÑ´Ù. print command ´Â ½ÇÁ¦ÀÇ Àμâ¸í·ÉÀ¸·Î¼ ±×´ë·Î ÀμâµÇ´ÂÁö
SHELL¿¡¼ ½ÇÇà½ÃÄÑ º¸µµ·Ï ÇÑ´Ù.
# lpr -r -h -P <printer name> <Àμâ ÆÄÀϸí>
ÀÌ·¸°Ô ÇÏ¿© ÀμⰡ µÇ¸é samba¸¦ ÅëÇÏ¿© ÀμâÇÏ¸é º¸Åë ¼º°øÇÏ°Ô µÈ´Ù.
¸¸ÀÏ ÀμⰡ µÇÁö ¾ÊÀ¸¸é /var/log/samba ¿¡ ÀÖ´Â ·Î±×ÆÄÀÏ À» ÂüÁ¶Çϵµ·Ï
ÇÑ´Ù. ÀμⰡ ½ÇÆÐÇÒ °æ¿ì¿¡ PC·Î ºÎÅÍ Àü¼ÛµÈ ÆÄÀÏÀº spool µð·ºÅ丮¿¡
À§Ä¡ÇÏ°Ô µÇ¹Ç·Î lpr ¸í·ÉÀ¸·Î¼ Àμ⸦ ½ÃÄѺ¸¾Æ¼ Á¤»óÀûÀ¸·Î Ãâ·ÂµÇ°Ô
µÇ¸é ¾îµò°¡ ¿¬°á°í¸®°¡ ¹®Á¦°¡ Àִ°ÍÀ̹ǷΠÂ÷±ÙÂ÷±Ù È®ÀÎÇØ º¸µµ·Ï
ÇÑ´Ù. Àü¼ÛµÇ´Â ¿¬°á°í¸®´Â ´ÙÀ½°ú °°À¸¸ç °¢°¢ ¾Æ·¡ÀÇ ÆÄÀÏÀ» ÂüÁ¶ÇÑ´Ù.
PC Client -> Sambar Server ----> lpr ------------> Printer
(PCÁ¶ÀýÆÇ) (/etc/smb.conf) (/etc/printcap)
Áï PC¿¡¼ Àμ⸦ ¸í·ÉÇϸé Printer Driver °¡ ÇÁ¸°ÅÍ Á¦¾î À̹ÌÁö¸¦
»ý¼ºÇÏ°í LanManager ÀÇ ÆÐŶÀ¸·Î SAMBA ¼¹ö¿¡ º¸³»¸é ÀÌ°ÍÀ» smb.conf ¿¡
ÁöÁ¤ÇÑ spool µð·ºÅ丮¿¡ ÀúÀåÇÑÈÄ lpr ¸í·ÉÀ¸·Î Àμ⸦ Áö½ÃÇÑ´Ù. lpr Àº
printcap ÆÄÀÏÀÇ ÁöÁ¤µÈ ¿É¼Ç¿¡ µû¶ó¼ ÇÁ¸°ÅÍ¿¡ ÀμâÆÄÀÏÀ» º¸³»°Ô µÈ´Ù.
2. SAMBA ¿¡¼ REMOTE-PC ÃøÀÇ ÇÁ¸°ÅÍ ¼¼Æà °ü·Ã
PCÃø¿¡ ¿¬°áµÈ ¸®¸ðÆ® ÇÁ¸°Å͸¦ LINUXÀÇ SAMBA ¿¡¼ Á¢±ÙÇÏ´Â ¹æ¹ýÀº Á¶±Ý
´Ù¸£´Ù. ÀÌ°ÍÀº LINUXÀÇ printcap¿¡ ÀÖ´Â ÇÊÅ͸¦ ÀÌ¿ëÇÏ´Â °ÍÀ¸·Î »ý¼ºµÈ
ÇÁ¸°Æ®ÆÄÀÏÀ» ´Ù½Ã ÇÁ¸°ÅÍ°¡ ¿¬°áµÈ PC·Î Àü¼ÛÇÑ´Ù.
PC Client -> Sambar Server ----> lpr ------------> smbprint -----> PC ----> Printer
(PCÁ¶ÀýÆÇ) (/etc/smb.conf) (/etc/printcap) .config (ÇÁ¸°Åͼ¹ö)
¡¡ µû¶ó¼ lpr ¸í·É½Ã¿¡ ÂüÁ¶ÇÏ´Â printcap ÆÄÀÏ¿¡ ÇÊÅ͸¦ ÁöÁ¤ÇÏ´Â if
¿É¼Ç¿¡ smbprint¸¦ ¼öÇàÇϵµ·Ï ÁöÁ¤ÇÏ°í ÀÖÀ¸¸ç smbprint´Â smbclient¸¦
È£ÃâÇÏ¿© PC¿¡ ÆÄÀÏÀ» Àü¼ÛÇÑ´Ù. À̶§ PC¼¹ö¿¡ Á¢¼ÓÇÒ¼ö ÀÖ´Â ±ÇÇÑÀ» ¾ò±â
À§ÇÏ¿© .config ÆÄÀÏ¿¡ ¼¹ö¸í, ¼ºñ½º¸í ¹× ºñ¹Ð¹øÈ£ ±â·ÏÇØ ³õ¾Æ¼
smbclient°¡ ÇØ´çÁ¤º¸¸¦ ȹµæÇÒ ¼ö ÀÖµµ·Ï ÇÑ´Ù.
lp|lj|HP LJ6P:\
:lp=/dev/null:\
:sd=/var/spool/lpd/lj:\
:mx#0:sh:sf:\ :if=/usr/bin/smbprint:
:af=/var/spool/lpd/lp/acct:
À̶§ LINUX¿¡´Â ÇÁ¸°ÅÍ°¡ ¿¬°áµÈ °ÍÀÌ ¾Æ´Ï¹Ç·Î lp ´Â null µð¹ÙÀ̽º¸¦
ÁöÁ¤ÇÑ´Ù. if °¡ ÇÊÅͷμ smbprint´Â script ÆÄÀÏÀÌ´Ù. ±×ÆÄÀÏÀÇ ³»ºÎ¿¡
¼¹ö ¹× ¼ºñ½º, ºñ¹Ð¹øÈ£¸¦ ¾òÀºÈÄ smbclient¸¦ ¼öÇàÇÏ´Â script°¡
Æ÷ÇԵǾî ÀÖ´Ù.
-- ¾Õ¿¡´Â »ý·« ---
eval `cat $config_file`
#
# Some debugging help, change the >> to > if you want to same space.
#
echo "server $server, service $service" >> $logfile
(
# NOTE You may wish to add the line `echo translate' if you want automatic
# CR/LF translation when printing.
# echo translate
echo "print -"
cat
) | /usr/bin/smbclient "\\\\$server\\$service" $password -U $server -N -P >> $lo
gfile
$config ÆÄÀÏÀº º¸Åë spool µð·ºÅ丮¿¡ .config ÆÄÀÏ·Î Á¸ÀçÇÑ´Ù. (»ý·«µÈ
ºÎºÐ È®ÀÎ) .configÀÇ ³»¿ëÀº
server=PC_SERVER
service=PR_SHARENAME
password="password"
¿Í °°Àº ASCII ÆÄÀÏ·Î »ý¼ºÇÑ´Ù. password ´Â ²À "(´õºí Äí¿ÀÅ×À̼Ç)·Î
¿°í ´Ý¾Æ¾ß ÇÏ¸ç ºñ¹Ð¹øÈ® ¾øÀ» ½Ã¿¡´Â "" ·Î Ç¥ÇöÇÑ´Ù. À̺κп¡¼
ÆÄÀÏÀÌ Á¦´ë·Î Àü¼ÛµÇÁö ¾ÊÀ» ½Ã¿¡´Â spool ÆÄÀÏ¿¡ »ý¼ºµÈ ÆÄÀÏÀ» Á÷Á¢
smbclient¸¦ ½ÇÇà½ÃÄÑ PC¿¡¼ ÀμâµÇ´ÂÁö È®ÀÎÇØ º»´Ù.
# smbclient '\\mimas\lj' <passwd> -U mimas -N -P
ÀÌ¿Í °°ÀÌ Çؼ ÀμⰡ µÈ´Ù¸é À§¿¡¼ ±â¼úÇÑ ¿¬°á°ü°è°¡ ¿øÇÒÇÏÁö ¾ÊÀº
¿øÀÎÀ¸·Î smbclient°¡ ½ÇÇàµÇÁö ¾Ê´Â°ÍÀ̹ǷΠLOG ÆÄÀϵîÀ» Â÷±ÙÂ÷±ÙÈ÷
»ìÆ캸µµ·Ï ÇÑ´Ù. ÀμⰡ µÇÁö ¾Ê´Â´Ù¸é ÇÁ¸°ÅÍ°¡ ¿¬°áµÈ PC¼¹ö¿¡ ¹®Á¦°¡
Àִ°ÍÀ¸·Î ÃßÁ¤ÇÒ ¼ö ÀÖÀ¸¹Ç·Î ÇØ´ç PC¼¹ö¿¡¼ ÇÁ¸°ÅÍÀÇ ¿¬°á°ü°è¸¦
È®ÀÎÇØ º¸µµ·Ï ÇÑ´Ù. ¡¡
|
|
Page Loading [ 0.03 Sec ]
SQL Time [ 0 Sec ]
|
|
|