Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3343240
  • 博文数量: 815
  • 博客积分: 12898
  • 博客等级: 上将
  • 技术积分: 7883
  • 用 户 组: 普通用户
  • 注册时间: 2006-12-25 09:57
文章分类

全部博文(815)

文章存档

2014年(1)

2011年(46)

2010年(192)

2009年(121)

2008年(70)

2007年(385)

分类: BSD

2007-07-11 00:51:46

The following steps can be used to install on .

Notes:

  • These steps seem to work on OpenBSD . Click one of the following links for instructions covering prior releases:

  • The needs to be installed. See the for directions on how to install the ports collection.

  • Click one of the following links for copies of the samba config file :
    , .

Related Urls:

Steps:

  1. Untar the port in /usr/ports/net/samba:

    # cd /usr/ports/net/samba 
    # ftp
    # tar -xvzf port-obsd37_net_samba_3.0.14a.tgz
  2. Build samba:

    # cd 3.0.14a
    # make install
  3. Add the following to /etc/rc.local in order to have Samba automatically started during boot:

    if [ -f /etc/samba/smb.conf -a X"${samba}" != X"NO" ]; then
    if [ X"${smbd_flags}" != X"NO" -a -x /usr/local/libexec/smbd ]; then
    echo -n ' smbd'; /usr/local/libexec/smbd ${smbd_flags}
    fi
    if [ X"${nmbd_flags}" != X"NO" -a -x /usr/local/libexec/nmbd ]; then
    echo -n ' nmbd'; /usr/local/libexec/nmbd ${nmbd_flags}
    fi
    fi
    This can be added around line 19 in /etc/rc.local.
  4. Enable Samba:

    # echo 'smbd_flags="-D"' >> /etc/rc.conf.local
    # echo 'nmbd_flags="-D"' >> /etc/rc.conf.local
    To run Samba without NetBIOS name resolution (nmbd), set nmbd_flags=NO instead.
  5. Customize /etc/samba/smb.conf:

    • Set the workgroup by change the following:

      workgroup = MYGROUP
      to
      workgroup = workgroup
      

      This is around line 26.

      If a NT Domain/Workgroup doesn't exist, the workgroup can be set to the DNS domain name.
    • Set the server string by changing the following:

      server string = Samba Server
      to
      server string = hostname
      
      This is around line 29.
    • Enable password encryption for the [global] share by adding the following:

      # Enable password encryption
      encrypt passwords = yes
      This can be added around line 36.
    • (Optional) Prevent access to certain files:

      # Prevent access to restricted files
      hide unreadable = yes
      browseable = no
      veto files = /*.exe/*.dll/*.pif/*.com/*.vbs/*.{*}
      hide files = /example.txt/*.ico/
      This can be added around line 40.
    • (Optional) Disable lm announce:

      # Disable lm announce
      lm announce = no
      lanman auth = no
      min protocol = NT1
      This can be added around line 46.
    • (Optional) Disable printer loading by changing the following:

      load printers = yes
      to
      load printers = no
      This is around line 45 in the default version of smb.conf and line 64 if you have made all of the previous changes.
    • (Optional) Put logs in a /var/log/samba:

      1. Changing the following:
        log file = /var/log/smbd.%m
        to
        log file = /var/log/samba/smbd.%m

        This is around line 66 in the default version of smb.conf and line 88 if you have made all of the previous changes.

      2. Create the directory /var/log/samba:
        # mkdir -p /var/log/samba
    • (Optional) Disable the [printers] share by changing the following:

      [printers]
      comment = All Printers
      path = /var/spool/samba
      browseable = no
      # Set public = yes to allow user 'guest account' to print
      guest ok = no
      writable = no
      printable = yes
      to
      ;[printers]
      ; comment = All Printers
      ; path = /var/spool/samba
      ; browseable = no
      # Set public = yes to allow user 'guest account' to print
      ; guest ok = no
      ; writable = no
      ; printable = yes
      This starts around line 192 in the default version of smb.conf and line 230 if you have made all of the previous changes.
    • (Optional) Act as a time server:

      # Act as a time server
      time server = yes
      This can be added around line 60.
    • (Optional) On systems with multiple interfaces, restrict access to samba:

         hosts allow = networks
      hosts deny = ALL
      bind interfaces only = yes
      interfaces = interfaces

      To connect via the loopback interface networks needs to contain 127. and interfaces needs to contains lo0.

      These changes can be added around line 42 in the default version of smb.conf and line 56 if you have made all of the previous changes.
  6. Valiate smb.conf:

    # /usr/local/bin/testparm -s
  7. Save the default smbpasswd and secrets.tdb:

    # cd /etc/samba
    # mv secrets.tdb secrets.tdb.default
    # mv smbpasswd smbpasswd.default
  8. Set the samba password for users who need samba access:

    # /usr/local/bin/pdbedit -a username
    
  9. Reboot or start smbd and/or nmbd manually:

    # /usr/local/libexec/smbd -D
    # /usr/local/libexec/nmbd -D
  10. (Optional) Check to see if samba is running:

    $ ps -auwxx | egrep '[sn]mbd'
    root 909 0.0 0.8 6504 4008 ?? Is 11:29PM 0:00.00 /usr/local/libexec/smbd -D
    root 911 0.0 0.4 3488 2048 ?? Ss 11:29PM 0:00.00 /usr/local/libexec/nmbd -D
  11. (Optional) Test samba using smbclient:

    $ /usr/local/bin/smbclient -U username \\\\localhost\\username
    
    or
    $ /usr/local/bin/smbclient -U username //localhost/username
    
阅读(1683) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~