⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smb-howto.txt

📁 linux-bible.rar linux-bible.rar
💻 TXT
📖 第 1 页 / 共 3 页
字号:
   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 + -