Sambaの設定方法


SambaはSlackwareをインストールした段階で、すでにLINUXマシンに入っていまが,

設定を行う上で、色々と問題が発生しました。もしsambaを御利用になるのでしたら、sambaを再インストールしてください。

ftp://mirror.nucba.ac.jp/pub/samba/からダウンロードができます。

また、SlackWareのSOURCE/Nにsamba-2.2.0a_tar.gzがあるのでそれを使うのもよいのではないでしょうか

SAMBAの設定は一筋縄ではできませんでした。根気・忍耐・寛容が必要です。(LINUXには常に必要ですね(^○^))

設定で困った時はhttp://samba.bento.ad.jp/SAMBAの日本語マニアル





◆SMABAの設定は以下の手順で行ないます。
  1. SAMBAのインストール

  2. SAMBAの設定

  3. SAMBAの接続テスト

  4. SAMBAの仕上げ

  5. SAMBAの起動

  6. Win98の設定




◆SAMBAのインストール

  1. SAMBAの終了と前準備

    SAMBAはマシンを起動しますと自動的にSAMBAも起動されますので、SAMBAを終了させます。

    # killall smbd

    # killall nmbd

    #cd /usr/local/

    /uer/local# mv samba samba-old で現行のSAMBAをコピーしておく。


  2. SAMBAのインストール

    インストールについては、Slackware-8.0のsource添付されているsamba-2.2.0aのインストール方法を説明します。

    # mount -t iso9660 /dev/cdrom /cdrom
    
    # cd /usr/local/src
    
    /usr/local/src# tar zxvf /cdrom/slackware/source/n/samba/samba-2.2.0a_tar.gz
    
    /usr/local/src# cd samba-2.2.0a/source
    
    /usr/local/src/samba-2.2.0a/source# ./configure 
    
    /usr/local/src/samba-2.2.0a/source# make
    
    /usr/local/src/samba-2.2.0a/source# make install
    
    




    トップへ戻る

    ◆SAMBAの設定

      SAMBAの設定は以下のとおりに行ないました。
    1. smb.confの修正
      /usr/local/src/samba-2.2.0a/source# cp /usr/local/src/samba-2.2.0a/examples/smb.conf.default /etc/samba/lib/smb.conf   
      Slackwareでは、smb.confは/etc/samba/libにおかれることになっていますので注意してください。
      
      /usr/local/src/samba-2.2.0a/source# cd /etc/samba/lib   
       
      /etc/samba/lib# vi smb.conf                で以下の赤字部分を修正しました。
      ========================================================================================================
      # This is the main Samba configuration file. You should read the
      # smb.conf(5) manual page in order to understand the options listed
      # here. Samba has a huge number of configurable options (perhaps too
      # many!) most of which are not shown in this example
      #
      # Any line which starts with a ; (semi-colon) or a # (hash) 
      # is a comment and is ignored. In this example we will use a #
      # for commentry and a ; for parts of the config file that you
      # may wish to enable
      #
      # NOTE: Whenever you modify this file you should run the command "testparm"
      # to check that you have not many any basic syntactic errors. 
      #
      #======================= Global Settings =====================================
      [global]
      
      # workgroup = NT-Domain-Name or Workgroup-Name, eg: REDHAT4   workgroup = NTドメイン名もしくはワークグループ名  
      
         workgroup = WORKGROUP
      
      # server string is the equivalent of the NT Description field  NTの解説フィールドと同等 
         server string = Samba Server
      
      # This option is important for security. It allows you to restrict  このオプションはセキュリティ上重要です。この設定によってローカルネット
      # connections to machines which are on your local network. The    ワークにおけるマシンからの接続を制限することが可能です。以下の例では2つの 
      # following example restricts access to two C class networks and  クラスCのネットワークと”ループバック”インターフェースからの接続のみを
      # the "loopback" interface. For more examples of the syntax see   許可するという制限です。この文法についての詳細につきましては、smb.conf
      # the smb.conf man page                         のマニアルページを参照してください。
         hosts allow = 192.168.0. 127.                    ローカルネットワークとループバッックアドレスを指定します。
      
      # If you want to automatically load your printer list rather     もし、プリンタのリストを個々に設定するのではなく、自動的にプリンタのリスト
      # than setting them up individually then you'll need this       を読み込む場合は、ここを設定する必要があります
         load printers = yes
      
      # you may wish to override the location of the printcap file      printcapファイルの場所を指定したい場合は、ここを設定します。
      ;   printcap name = /etc/printcap
      
      # on SystemV system setting printcap name to lpstat should allow    SystemVのシステムにおいて、printcap名をlpstatに設定する場合は、
      # you to automatically obtain a printer list from the SystemV spool  SystemVスプールシステムから自動的にプリンタのリストを得ることができます。
      # system
      printcap name = /etc/printcap    プリンタの指定です。プリンタ設定時を確認してください、
      
      # It should not be necessary to specify the print system type unless  もし、標準でない印刷システム(プリンタ)を使用している場合は、この設定が必要です。
      # it is non-standard. Currently supported print systems include:    bsd, sysv, plp, lprng, aix, hpux, qnx が利用可能です 
      # bsd, sysv, plp, lprng, aix, hpux, qnx
        printing = bsd                              BSD(標準)で印刷します。
      
      # Uncomment this if you want a guest account, you must add this to /etc/passwd  ゲストアカウントが必要な場合は、コメントをはずします。また、nobodyを
      # otherwise the user "nobody" is used                        以外を指定する場合は/etc/passwdにユーザを登録する必要があります。
      ;  guest account = pcguest
      
      # this tells Samba to use a separate log file for each machine           接続されているマシンごとに各々ログを残す場合は、コメントをはずします。
      # that connects
         log file = /usr/local/samba/var/log.%m
      
      # Put a capping on the size of the log files (in Kb).                     ログファイルの最大容量でKB(キロバイト)単位で指定します。
         max log size = 50
      
      # Security mode. Most people will want user level security. See           セキュリティモード、Userレベルのセキュリティを多くの人々が必要としているでしょう
      # security_level.txt for details.                                         詳細については、security_level.txt を参照。
         security = user
      # Use password server option only with security = server                  security = serverの場合は、password serverを使用しましょう。
      ;   password server = 
      
      # You may wish to use password encryption. Please read                    パスワードの暗号化を使用する場合は、sambaドキュメントのENCRYPTION.txt, Win95.txt and WinNT.txt を読んでください
      # ENCRYPTION.txt, Win95.txt and WinNT.txt in the Samba documentation.     これらのドキュメントを読まないで、このオプションを設定しないでください、
      # Do not enable this option unless you have read those documents
        encrypt passwords = yes                                                 暗号化パスワードを使用します。使用しない場合はnoもしくはコメントにする。
      
      # Using the following line enables you to customise your configuration    この行で、マシンごとの設定をカスタマイズすることができます。%mは接続しているマシンのNetBIOS名に置き替ります。
      # on a per machine basis. The %m gets replaced with the netbios name
      # of the machine that is connecting
      ;   include = /usr/local/samba/lib/smb.conf.%m
      
      # Most people will find that this option gives better performance.        ほとんどの人々は、このオプションでより良い性能を得ることができるでしょう。
      # See speed.txt and the manual pages for details                          詳細につきましては、speed.txt およびsambaのマニアルを参照。
         socket options = TCP_NODELAY 
      
      # Configure Samba to use multiple interfaces                              複数のインターフェースに対するsambaの設定
      # If you have multiple network interfaces then you must list them         複数のネットワーク環境を使用している場合には、ここに設定する必要があります。詳細はsambaマニアルを参照。
      # here. See the man page for details.
        interfaces = 192.168.0.1/24 127.0.0.1/8                                  利用可能なローカルアドレスの範囲指定です。
      
      # Browser Control Options:                                                ブラウザ制御オプション:
      # set local master to no if you don't want Samba to become a master       sambaをネットワーク上でマスタブラウザとしたくない場合は、local master = no を設定してください
      # browser on your network. Otherwise the normal election rules apply      通常の場合は、local master = yesです。
        local master = no
      
      # OS Level determines the precedence of this server in master browser     ネットワーク上にWindows NT Serverもしくは他のWins Serverがある場合は#にします。
      # elections. The default value should be reasonable                       OS Levelは、マスタブラウザ選択の優先順位を指定します。デフォルト値は33です。 
         os level = 65                                                         LINUXの場合は65です。 
      
      # Domain Master specifies Samba to be the Domain Master Browser. This   Domain masterはsambaにドメイマスタブラウザになるように指定します。 
      # allows Samba to collate browse lists between subnets. Don't use this  これにより、sambaはサブネット間のブラウズリストの照会を行ないます。すでにWindowsNTドメイン 
      # if you already have a Windows NT domain controller doing this job    コントローラが存在する場合は、この指定を行なわないでください。
        domain master = yes                             ネットワーク上にWindows NT Serverもしくは他のWins Serverがある場合は#にします。
      
      # Preferred Master causes Samba to force a local browser election on startup  Preferred Masterはsambaに起動時にローカルブラウザとして起動するように指示をします。
      # and gives it a slightly higher chance of winning the election
        preferred master = yes                           ネットワーク上にWindows NT Serverもしくは他のWins Serverがある場合は#にします。
      
      # Use only if you have an NT server on your network that has been     すでにインストール段階でプライマリドキュメントコントローラとして、NTサーバがネットワーク上に存在する
      # configured at install time to be a primary domain controller.      場合のみ、ここを設定してください。 
      ;   domain controller = 
      
      # Enable this if you want Samba to be a domain logon server for       sambaをwindows95ワークステーションに対するドメインログサーバとしたい場合は、
      # Windows95 workstations.                            ここで設定します。 
         domain logons = yes                             ドメインへのログオン
      
      # if you enable domain logons then you may want a per-machine or      domain logons = yesにした場合にのみ、マシンごとかユーザごとにログオンスクリプトを指定できる。
      # per user logon script
      # run a specific logon batch file per workstation (machine)         ワークステーション(マシン)ごとに指定されたログオンパッチを起動する。
      ;   logon script = %m.bat                           ユーザ名ごとに指定されたログオンパッチを起動する。 
      # run a specific logon batch file per username
      ;   logon script = %U.bat
      
      # Where to store roving profiles (only for Win95 and WinNT)         (win95とWinNTのみ)で移動プロファイルを保存する場所の指定。 
      #        %L substitutes for this servers netbios name, %U is username    %Lは、このサーバのNetBIOS名、%Uは、ユーザ名に置き換えられる。
      #        You must uncomment the [Profiles] share below            [Profiles] は、コメントを外さなければならない。
      ;   logon path = \\%L\Profiles\%U
      
      # Windows Internet Name Serving Support Section:                  Windows Internet Name Serving Support Section:読んで字のごとし、
      # WINS Support - Tells the NMBD component of Samba to enable it's WINS Server   sambaのWINS Support - TellsのNMBDコンポーネントのWINS を有功にする。
        wins support = yes                                 ネットワーク上にWindows NT Serverもしくは他のWins Serverがある場合は#にします。
      
      # WINS Server - Tells the NMBD components of Samba to be a WINS Client      sambaのWINS Support - TellsのNMBDコンポーネントにWINSクライアントになるように指定する。
      #       Note: Samba can be either a WINS Server, or a WINS Client, but NOT both  注意: SambaはWinsサーバにもWinsクライアントにもなることができるが、同時に両方にはなれない。
      ;   wins server = w.x.y.z                              ネットワーク上にWindows NT Serverもしくは他のWins Serverがある場合は、そのIPアドレスを入れます。
      
      # WINS Proxy - Tells Samba to answer name resolution queries on         WINS Proxy - Tells Samba に対して、WINS機能のないクライアントからの名前要求があった場合に 
      # behalf of a non WINS capable client, for this to work there must be      回答するように指定する。この機能を使用するには、最低でも1つ以上のWINSサーバがネットワーク上に
      # at least one  WINS Server on the network. The default is NO.       存在しなければならない、デフォルトはnoである。
      ;   wins proxy = yes
      
      # DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names    DNS Proxy - tells SambaにNetBIOSネームをDNS経由で解決するか否かを指定する。 
      # via DNS nslookups. The built-in default for versions 1.9.17 is yes,     バージョンが1.9.17の時はデフォルトがyesだが、1.9.18でnoに変更されたので要注意。 
      # this has been changed in version 1.9.18 to no.
         dns proxy = no 
      
      #============================ Share Definitions ==============================
      [homes]
         comment = Home Directories
         browseable = no
         writable = yes
      
      # Un-comment the following and create the netlogon directory for Domain Logons   ドメインログオンを提供する場合は、以下のコメントを外してnetlogonディレクトリを作成してください。
      [netlogon]
      ;   comment = Network Logon Service
        path = /usr/local/samba/logon                         ホームディレクトリです確認してください、
        guest ok = yes                                     Guestで使用可能
        writable = no                                      書き込み禁止
      ;  share modes = no
      
      
      # Un-comment the following to provide a specific roving profile share
      # the default is to use the user's home directory
      ;[Profiles]
      ;    path = /usr/local/samba/profiles
      ;    browseable = no
      ;    guest ok = yes
      
      
      # NOTE: If you have a BSD-style print system there is no need to            注意:BSDスタイルの印刷システム(プリンタ)を使用している場合は、各々のプリンタ
      # specifically define each individual printer                      定義を行なう必要はありません、
      [printers]
         comment = All Printers                                 プリンタの共有です。
         path = /usr/spool/samba                                 SPOOLを確認してください、                       
         browseable = no
      # Set public = yes to allow user 'guest account' to print
         guest ok = no
         writable = no
         printable = yes
      
      # This one is useful for people to share files
      ;[tmp]
      ;   comment = Temporary file space
      ;   path = /tmp
      ;   read only = no
      ;   public = yes
      
      # A publicly accessible directory, but read only, except for people in
      # the "staff" group
      ;[public]
      ;   comment = Public Stuff
      ;   path = /home/samba
      ;   public = yes
      ;   writable = yes
      ;   printable = no
      ;   write list = @staff
      
      # Other examples. 
      #
      # A private printer, usable only by fred. Spool data will be placed in fred's
      # home directory. Note that fred must have write access to the spool directory,
      # wherever it is.
      ;[fredsprn]
      ;   comment = Fred's Printer
      ;   valid users = fred
      ;   path = /homes/fred
      ;   printer = freds_printer
      ;   public = no
      ;   writable = no
      ;   printable = yes
      
      # A private directory, usable only by fred. Note that fred requires write
      # access to the directory.
      ;[fredsdir]
      ;   comment = Fred's Service
      ;   path = /usr/somewhere/private
      ;   valid users = fred
      ;   public = no
      ;   writable = yes
      ;   printable = no
      
      # a service which has a different directory for each machine that connects
      # this allows you to tailor configurations to incoming machines. You could
      # also use the %U option to tailor it by user name.
      # The %m gets replaced with the machine name that is connecting.
      ;[pchome]
      ;  comment = PC Directories
      ;  path = /usr/pc/%m
      ;  public = no
      ;  writable = yes
      
      # A publicly accessible directory, read/write to all users. Note that all files
      # created in the directory by users will be owned by the default user, so
      # any user with access can delete any other user's files. Obviously this
      # directory must be writable by the default user. Another user could of course
      # be specified, in which case all files would be owned by that user instead.
      ;[public]
      ;   path = /usr/somewhere/else/public
      ;   public = yes
      ;   only guest = yes
      ;   writable = yes
      ;   printable = no
      
      # The following two entries demonstrate how to share a directory so that two
      # users can place files there that will be owned by the specific users. In this
      # setup, the directory should be writable by both users and should have the
      # sticky bit set on it to prevent abuse. Obviously this could be extended to
      # as many users as required.
      ;[myshare]
      ;   comment = Mary's and Fred's stuff
      ;   path = /usr/somewhere/shared
      ;   valid users = mary fred
      ;   public = no
      ;   writable = yes
      ;   printable = no
      ;   create mask = 0765
      ========================================================================================================  
      
      
      CATION!! プリンタを共有しない場合でも、「printing」および「printcap name」は設定しておいてください。


      ここでは、SMB.CONFが正しく設定できたか否かの確認を行います。


    2. testparmでのテスト
      # /usr/local/samba/bin/testparm と入力しますと以下のメッセージが表示されます。
      
      Load smb config files from /usr/local/samba/lib/smb.conf
      
      Processing Section  "[homes]"
      
      Processing Section  "[netlogon]"
      
      Processing Section  "[tanaka]"
      
      Processing Section  "[hirosima]"
      
      Processing Section  "[cdrom]"
      
      Processing Section  "[printers]"
      
      Load service file OK.
      
      Press enter to see a dump of your service definitions        [Enter]を押してください、もし、不幸にして上記のメッセージが表示されない
                                                   場合はsmb.confの設定を間違えている可能性があります。
      
      # Global parameters
      
              debuglevel  =  2
      
              syslog  =  1
        
              syslog only  = no
      
              protocol  =  NT1
      
              security  =  SHARE
      
              max disk size  =  0
      
              lpq cache time =  10
        
              announce as  =  NT
      
              encrypt passwords  =  NO
      
      [lp]
              path  =  /usr/spool/samba
      
              read only  =  NO
      
              guest ok   =  OK
      
              print ok   =  OK
      
              share mode  =  NO
      
              oplocks     =  NO
      
              printer     =  LP
      
      [BJC-465J]
      
              comment  =  lp
      
              path     =  /usr/spool/samba
      
              read only  =  NO
      
              guest ok   =  OK
      
              print ok   =  OK
                    :
                    :
                    :
      
      

    3. lmhostsの作成
      /usr/local/samba/lib/にlmhostsファイルを作成します。
      # cd /usr/local/samba/lib/  
      
      /usr/local/samba/lib/# mkdir lmhosts
      
      /usr/local/samba/lib/# vi lmhosts
      =======================================================================================================
      0.0.0.0 WORKGROUP G        ワークグループ名を確認してください。
      
      #
      192.168.0.1 you               IPアドレス、ホスト名をいれます。 
      
      192.168.0.255 WORKGROUP S
      ========================================================================================================
      


    4. SAMBAで使用するSPOOL関係のディレクトリーを作成します。
      # mkdir /usr/local/samba/logon         logonのディレクトリーを作成します。
      
      # mkdir /usr/spool/samba              
      
      # chmod 777 /usr/spool/samba
      
      


    5. SAMBAのパスワードファイルの作成

      暗号化パスワードを使用する場合は、以下の要領でSAMBA専用パスワードファイルを作成します。
      # cd /usr/local/src/samba-2.2.0a/source 
      
      /usr/local/src/samba-2.2.0a/source# mkdir /usr/local/samba/private 
      
      /usr/local/src/samba-2.2.0a/source# cd script 
      
      /usr/local/src/samba-2.2.0a/source/script# chmod 700 mksmbpasswd.sh 
      
      /usr/local/src/samba-2.2.0a/source/script# cat /etc/passwd | ./mksmbpasswd.sh > /usr/local/samba/private/smbpasswd 
      
      /usr/local/src/samba-2.2.0a/source/script# chmod 500 /usr/local/samba/private 
      
      /usr/local/src/samba-2.2.0a/source/script# chmod 600 /usr/local/samba/private/smbpasswd 
      
      


    6. パスワード設定。
      # /usr/local/samba/bin/smbpasswd hirosima      hirosimaの部分を変更してください。         
      
      New SMB password:                 新しいパスワードを入力します。              
      
      Retry new SMB password:      もう一度、新しいパスワードを入力します。                    
      
      





    トップへ戻る

    ◆SAMBAの接続テスト

    smbclientでのテスト
    #cd /etc/rc.d
    #etc/rc.d#touch rc.samba
    #etc/rc.d#chmod  775 rc.samba
    #etc/rc.d#vi rc.samba
    /usr/sbin/smbd -D    を /usr/local/samba/sbin/smbd -D に変更する。
    /usr/sbin/nmbd -D    を /usr/local/samba/sbin/nmbd -D に変更する。
    :wqで終わって一度、マシンを再立ち上げを行う。
    
    # /usr/local/samba/bin/smbclient -L //hero01     hero01の部分は、自分のホスト名をいれます。      
    
    Added interface ip=192.168.0.1 bcast=192.168.0.255 nmask=255.255.255.0
    Server time is mon Mar 15 21:12:48 1999
    password:                  Enterを押してください、 
    Domain=[WORKGROUP] OS=[Unix] Server=[Samba 2.0.6]
    connected as guest security=user
                      :
                      :    と出ればOKですが、不幸にしてエラーとなられた方はDNSは立ち上がっていますか?
                      : 
    
    


  3. Windowsに繋ぐ。
    WINDOWSに繋ぐ場合は、繋ぐPC毎に以下の設定を行ってください。
    「コントロールパネル」→「ネットワーク」
    
      ◆TCP−IP         IPアドレス・・・・・・192.168.2.34(PCのアドレスを設定)
                             サブネットマスク・・・・255.255.255.0(Cクラスの場合は)確認してください、
    
      ◆microsoftネットワーク クライアント
                            クイックログオンを指定する
    
      ◆ユーザ情報           コンピュータ名・・・・・win1(自分のコンピュータ名)     
                            ワークグループ・・・・・WORKGROUP(定義したワークグループ名)
    
      ◆アクセス権の管理     共通レベルのアクセス管理を選択
    
    これでPCを再起動したら、ユーザID、とパスワードを聞きにきますので、正しく入れるとOKです。
    


トップへ戻る

◆SAMBAの仕上げ

何かが不足していますね。そうなんですsmbfsが足りないのです。smbfsは以下の要領で行ないました。

# smbmount //hero01/hirosima /mnt       /hero01/hirosimaのところを変更してください、
      エラーが出ないように注意しましょう。
ここで、パスワードエラーが発生した場合は、guest ok = noとなっている時rootでもマウントはできませんので、一度yesにしてください。







トップへ戻る





◆SAMBAの起動

# /usr/local/samba/bin/nmbd -D 

# /usr/local/samba/bin/smbd -D 

# /etcr/rc.d/rc.samba     でSAMBAが即起動します。


トップへ戻る





◆Win98の設定

Windows98からSAMBAに接続する為にパスワードを入力してもSAMBAに接続

できませんでした。Win95の時は問題なく接続できたのですが,,,,,,,,,?

この原因はWindows98が暗号化パスワードを利用しているためです。

そこで、以下の要領で平文パスワードをWin98から送るようにしました。



  1.  windows98の[スタート]メニューから[ファイル名を指定して実行]をクックする。

  2.  名前(O)に「regedit」を入力してenterを押す。

  3.  /HKEY_MACHINE/System/CurrentControlSet/Service/VxD/VNETSUPに移動する。

  4.  メニュー[編集(E)]→[新規作成(N)]→[DWORD値(D)]を選択

  5.  「新規値#1」ができるので「EnablePlainTextPassword」に変更する。

  6.  「EnablePlainTextPassword」をダブルクリックをする。

  7.  [DWORD値の編集]の[値のデータ(V)]に"1"を入力して[OK]を押す。

  8.  Win98を再起動


トップへ戻る



LINUXのページに戻る。


ご質問・お問い合わせ - 免責事項
Copyright (C) 1998 hero-island. All Rights Reserved.