欧美视频综合-欧美视频中文字幕-欧美视频在线观在线看-欧美视频在线观看网站-直接观看黄网站免费视频-正在播放久久

機電之家資源網
單片機首頁|單片機基礎|單片機應用|單片機開發|單片機文案|軟件資料下載|音響制作|電路圖下載 |嵌入式開發
培訓信息
贊助商
Linux 網管 123 --- 第7章. 自訂的組態及管理內容 -4.使用 Samba
Linux 網管 123 --- 第7章. 自訂的組態及管理內容 -4.使用 Samba
 更新時間:2009-8-12 16:58:43  點擊數:0
【字體: 字體顏色
使用 Samba 進行 Windows型態的檔案及列印服務

Linux可以使用 Samba 套件提供 SMB 服務 (例如. WfW, Win95,及 NT型態的網路檔案及列印分享)。
這一節會描述如何組態分享,以及如何從客戶端存取這些服務。 
 Samba 套件包含在 Red Hat 發行版中,您可以檢查是否安裝以及其版本,鍵入: 
  rpm -q samba
 


如果尚未安裝,您需要使用 RPM 公用程式安裝它。 查看 第10章,使用 Red Hat 套件管理程式 (RPM) 
一節 有關如何做的細節。 

這些 Samba 檔中您應該關心的最重要部分是: 

/etc/smb.conf 

Samba 組態檔是分享及其他組態參數的設定 (查看下面) 
  
/var/log/samba/ 

放 Samba log 檔的地方 
  
/home/samba/ 

建議應該設定的檔案分享位置。 然而, 您應該選擇一個符合足夠您存放檔案空間的地方。個人來說,
我常設定一個大的 partition 掛載在 /archive/  下并且放我的分享檔案。
 ``/etc/smb.conf'' 檔包含了檔案及列印分享的組態資訊。檔案的開頭幾行包含了整體的組態方針,所
 有的分享都相同 (除非他們超越了每一個獨立分享的基礎),其馀的是分享部分。 
Samba 安裝包括了一個預設的 smb.conf 檔,可以滿足您大多數的需求,且只需作稍微的修改。 

這是這個檔的 一些例 (我會大幅地自訂它給您看看更多重要及有趣的部分): 
  # Items common to all shares (unless over-ridden on a per-share basis)
[global]
   # Number of minutes of inactivity before client is disconnected
   # to avoid consuming resources.  Most clients will automatically
   # reconnect so this is a good idea to enable.
   dead time = 10

   # Don't let users connect as “root”, just-in-case.  :-)
   invalid users = root

   # Specify the account for guest shares (shares that don't require
   # a password to connect to.  This username must be a valid user
   # in the /etc/passwd file.
   guest account = guest

   # Specify where log files should be written to.  The “%m” suffix
   # means that log files will be created in the format
   # log.machine-name (eg. “log.twixel”)
   log file = /usr/local/samba/logs/log.%m

   # Maximum size of log file, in Kilobytes.
   max log size = 1000

   # Password level 3 means that case is not an issue when entering
   # passwords.  A little less secure than level 1 or 2 would be,
   # but seems to be a fair compromise for user convenience.
   password level = 3

   # Specify that all shares should appear in the browse list
   # (override any you don't want on a per-share basis).
   browseable = yes

   # If this is enabled, you can see active connections using the
   # “smbstatus” command.
   status = yes

   # The level of debugging information that is recorded in the log
   # files.  Higher values generate more information (which is
   # probably not very useful, most of the time).
   debug level = 2

   # This will send any Windows-style “POPUP” messages received on
   # the server to the postmaster by e-mail.  Not very useful, but
   # an interesting demonstration of what can be accomplished.
   message command = /bin/mail -s 'Message from %f on %m' postmaster < %s; rm %s &

   # This is a form of caching that, when enabled, may improve
   # performance when reading files.
   read prediction = true

   # A list of services that should be added automatically to the
   # browse-list.
   auto services = cdrom

   # The location of your “printcap” file, a text file containing
   # definitions for your printers.
   printcap name = /etc/printcap

   # If enabled all printers in the /etc/printcap file will be
   # loaded into the browse-list.
   load printers = yes

   # The print command by which data is spooled to a printer under Linux.
   print command = lpr -r -P%p %s

   # The print command by which job queue information (printer status)
   # can be obtained.
   lpq command = lpq -P%p

   # The print command by which unwanted print jobs can be deleted
   # from the queue.
   lprm command = lprm -P%p %j

   # The level at which Samba advertises itself for browse elections.
   # Currently set to a high value to give it an even “foot-hold” with
   # any swarmy NT servers on the network.  :-)
   os level = 34

# These are user's personal shares.  If the client's username matches on the
# server, they can access their home directory (provided they enter the
# correct password).
[homes]
   # The comments appear in the browse list.
   comment = Home Directories

   # This matches the username of the client to that of the share.
   # If they do not match, no share will be displayed in the browse
   # list, or available to connect to.
   user = %S

   # The path to the share.  For example, “smithj” would map to
   # “/home/smithj”
   path = /home/%S

   # If enabled, allow read/write access to the shares.
   writeable = yes

   # Just an inverted synonym for “writeable”.  We don't *really* need
   # to use both.  :-)
   read only = no

   # Keep this disabled so that a password is required to access these 
   # shares.
   public = no

   # We don't want this share (after all, it is private) to appear in
   # the browse-list of other users.
   browseable = no

# This is a publicly available print share, called “hp_laser”.  It appears
# on the browse lists and can be accessed without a password by any client.
[hp_laser]
   # The comment that appears in the browse-list.
   comment = Main office printer (HP Laserjet 400)

   # The username that this share is accessed as (guest means all users).
   user = guest

   # All generated print files will first be created in the /tmp
   # directory.
   path = /tmp

   # Do not allow file creation except through print spooling.
   writeable = no

   # Set permissions accordingly -- root access to print jobs only.
   create mode = 0700

   # If this is enabled a password is not required to access the share.
   public = yes

   # This should be enabled to indicate that this is a printer share.
   printable = yes

# Here is a service providing access to the CD-ROM device.
[cdrom]
   comment = Shared CD-ROM drive on Linux
   user = guest
   path = /cdrom
   writeable = no
   read only = true
   browseable = yes
   public = yes
   guest ok = yes
 


   小技巧: 最近的 Samba 版本, 從 2.0 以後,提供了一個非常靈活以網頁為基礎的組態公用程式叫做``swat'',
   可以使得組態過程更為友善。這個公用程式傾聽伺服器上的 TCP port 901 ,所以要使用的話必須將您的瀏覽器
   指向下面的位址: 

mydomain.name:901
 

(當然如果要使用 SWAT 的話您需要讓網頁伺服器執行,像是 Apache。 查看 第7章,網頁伺服器及 HTTP 快取代理
主機管理 一節 有關細節。) 

最新版的 Samba 和 2.0 版之前的相比增加了很多功能。 升級到這個版本是值得的。 

客戶端必須有 TCP/IP network stack 以連接分享。更進一步,為了瀏覽工作,TCP/IP 協定必須 bound 到
 NETBEUI。在 Windows 95 可以由控制臺中的``網路''進行組態。 

假設客端已經正常地組態好, 您應該可以看到伺服端的分享出現在“網路上的芳鄰” (或如果您不是使用
 Windows 95/NT的相等的方案)。您可以從網路上的芳鄰對映到網路磁碟,或鍵入到分享的絕對路徑
  (例如. “\\mail\cdrom”)。 如果分享服務需要鍵入密碼,您會被提示。 

更多有關 Samba的資料可以在 Samba Home Page http://samba.anu.edu.au/samba/中找到。
  • 上一篇: Linux 網管 123 --- 第7章. 自訂的組態及管理內容 -5.使用 Netatalk
  • 下一篇: Linux 網管 123 --- 第7章. 自訂的組態及管理內容 -3.使用 TACACS
  • 發表評論   告訴好友   打印此文  收藏此頁  關閉窗口  返回頂部
    熱點文章
     
    推薦文章
     
    相關文章
    網友評論:(只顯示最新5條。)
    關于我們 | 聯系我們 | 廣告合作 | 付款方式 | 使用幫助 | 機電之家 | 會員助手 | 免費鏈接

    點擊這里給我發消息66821730(技術支持)點擊這里給我發消息66821730(廣告投放) 點擊這里給我發消息41031197(編輯) 點擊這里給我發消息58733127(審核)
    本站提供的機電設備,機電供求等信息由機電企業自行提供,該企業負責信息內容的真實性、準確性和合法性。
    機電之家對此不承擔任何保證責任,有侵犯您利益的地方請聯系機電之家,機電之家將及時作出處理。
    Copyright 2007 機電之家 Inc All Rights Reserved.機電之家-由機電一體化網更名-聲明
    電話:0571-87774297 傳真:0571-87774298
    杭州濱興科技有限公司提供技術支持

    主辦:杭州市高新區(濱江)機電一體化學會
    中國行業電子商務100強網站

    網站經營許可證:浙B2-20080178-1