?? smb-howto.txt
字號:
write list = @staff ______________________________________________________________ 其他玩磁碟分享的技巧,請看 Samba 文件或 man pages. 7. 分享 Windows 磁碟給 Linux 機器 一種給 UNIX 機器用的 SMB client 程式被包含在 Samba 發行套件之中.它提供 一種在命令列下的像ftp的介面. 想要看在給定的主機上有哪些分享可取得, 執行: _________________________________________________________________ /usr/sbin/smbclient -L host _________________________________________________________________ 這□的 'host' 是你想要瀏覽的機器名子. 這將會回應一串 'service' 的名稱 - 也就是, 它所分享給你的磁碟或印表機的名稱. 除非 SMB 伺服器沒有安全上的 設定, 否則它將要求你輸入密碼. 給它 'guest' 帳號的密碼或是你個人在那臺機 器上帳號的密碼. 舉個例子: _________________________________________________________________ smbclient -L zimmerman _________________________________________________________________ 這個指令的輸出應該看起來像是這樣: ______________________________________________________________ Server time is Sat Aug 10 15:58:27 1996Timezone is UTC+10.0Password: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 DriversThis machine has a browse list: Server Comment --------- ------- HOPPER Samba 1.9.15p8 KERNIGAN Samba 1.9.15p8 LOVELACE Samba 1.9.15p8 RITCHIE Samba 1.9.15p8 ZIMMERMAN ______________________________________________________________ 這個 browse list 列出其他有資源分享給網路的 SMB 伺服器. 要使用此 client, 請執行: _________________________________________________________________ /usr/sbin/smbclient service <password> _________________________________________________________________ 這□的 'service' 是一臺機器和分享名稱. 舉例而言,如果你設法連到一臺叫做 zimmerman 的機器上之以 'public' 為分享名稱的目錄 ,此 service 要叫做 \\zimmerman\public. 然而,因為 shell 限制, 你會需要脫離 backslashes, 所 以你要像這樣的結束: _________________________________________________________________ /usr/sbin/smbclient \\\\zimmerman\\public mypasswd _________________________________________________________________ 這樣的 'mypasswd' 是你的密碼之文字串{literal string}. 你將會有 smbclient 的提示符號{prompt}出現: ______________________________________________________________ Server time is Sat Aug 10 15:58:44 1996Timezone is UTC+10.0Domain=[WORKGROUP] OS=[Windows NT 3.51] Server=[NT LAN Manager 3.51]smb: \> ______________________________________________________________ 鍵入 'h' 取得關於使用 smbclient 的 help: ______________________________________________________________ smb: \> hls dir lcd cd pwdget mget put mput renamemore mask del rm mkdirmd rmdir rd prompt recursetranslate lowercase print printmode queuecancel stat quit q exitnewer archive tar blocksize tarmodesetmode help ? !smb: \> ______________________________________________________________ 如果你能使用ftp,你應該不需要查詢 smbclient 的 man pages. 8. 分享 Linux 印表機給 Windows 機器 為了分享 Linux 印表機給 Windows 機器, 你必須確定你的印表機已經裝設好. 如果你能從 linux 上列印,設定 SMB 的印表機分享將會很直接. 請見 Printing HOWTO 來設定當地的列印. 因為作者使用被連接到 Windows NT 機器的印表機, 這小節不應該被視為很完整 的,而只是建議.任何有詳細資料可分享出來的人, 請將這些資料寄到 [7]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]下)要與 /etc/printcap中的 spool 目錄 相符合! 注意: 使用 Samba 來分享 UNIX boxes 上的印表機給 Windows NT 機器有一些問 題. 其中一個問題是使用 NT 適當地看到分享的印表機. 想要修正這個問題, 請 看 Samba 發行套件上的說明, 即 docs/WinNT.txt 檔案.其他是處理密碼的問 題. 對於這擾人問題的了解與不能成功的修正,請看相同文件上的說明. 9. 分享 Windows 印表機給 Linux 機器 為了分享 Windows 機器上的印表機, 你必須做以下步驟: a) 你必須在 /etc/printcap 內有適當的記錄,而且他們必須與當地目錄結構 (像 spool 目錄等) 相符合. b) 你必須有 script 檔 /usr/bin/smbprint. 這會隨附在 Samba source, 但不 是隨附於所有 Samba binary 發行套件. 一個稍微修改版本在以下討論. c) 如果你想要轉換 ASCII 檔到 Postscript,你必須有netscript,或與其等效 的. netscipt 是一種 Postscript 轉換器而且一般是安裝在 /usr/bin. d) 你可以希望藉由有易於使用的 frond end 來使 Samba 列印更容易. 一種用於 處理 ASCII, Postscript 或建立 Postscript 的簡單 perl script 在下面給 定. 以下 /etc/printcap 項目用在 Windows NT 主機上 HP 5MP 印表機. 這些項目如 下: _________________________________________________________________ cm - comment {說明} lp - device name to open for output {為了輸出,而要開啟的設備名稱} sd - the printer's spool directory (on the local machine) {印表機的 spool 目錄 (在當地的機器上)} af - the accounting file {帳號檔案} mx - the maximum file size (zero is unlimited) {最大檔案大小 (零表示沒限制)} if - name of the input filter (script) {輸入過濾之名稱 (script)} _________________________________________________________________ 要取得更多資訊,請看 Printing HOWTO 或者關於 printcap 的 man page. ______________________________________________________________ # /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: ______________________________________________________________ 請確定 spool 和 accounting{帳號} 的目錄存在且可寫入. 請確信某行有適當的 路徑指到 smbprint script (在下面會給) 而且確定適當的設備被指到 ( /dev 下某個檔). 下個是 smbprint script 本身. 它通常被擺在 /usr/bin 而且是因為 Andrew Tridgell 的緣故,而據我所知是他創造了 Samba. 它隨附在 Samba source 發行 套件, 但在某些 binary 發行套件并沒有, 所以在這我再造一個. 你可以希望仔細地看這個. 有某些較小的修改已經證明它們是很有用的. ______________________________________________________________ #!/bin/sh -x# This script is an input filter for printcap printing on a unix machine. It# uses the smbclient program to print the file to the specified smb-based# server and service.# For example you could have a printcap entry like this## smb:lp=/dev/null:sd=/usr/spool/smb:sh:if=/usr/local/samba/smbprint## which would create a unix printer called "smb" that will print via this# script. You will need to create the spool directory /usr/spool/smb with# appropriate permissions and ownerships for your system.# Set these to the server and service you wish to print to# In this example I have a WfWg PC called "lapland" that has a printer# exported called "printer" with no password.## Script further altered by hamiltom@ecnz.co.nz (Michael Hamilton)# so that the server, service, and password can be read from# a /usr/var/spool/lpd/PRINTNAME/.config file.## In order for this to work the /etc/printcap entry must include an# accounting file (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:## The /usr/var/spool/lpd/PRINTNAME/.config file should contain:# server=PC_SERVER# service=PR_SHARENAME# password="password"## E.g.# server=PAULS_PC# service=CJET_371# password=""## Debugging log file, change to /dev/null if you like.#logfile=/tmp/smb-print.log# logfile=/dev/null## The last parameter to the filter is the accounting file name.#spool_dir=/var/spool/lpd/lpconfig_file=$spool_dir/.config# Should read the following variables set in the config file:# server# service# password# usereval `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
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -