zoukankan      html  css  js  c++  java
  • samba setup

    Notice:This is a guest post from https://help.ubuntu.com/10.04/serverguide/samba-fileprint-security.html

    One of the most common ways to network Ubuntu and Windows computers is to configure Samba as a File Server. This section covers setting up a Samba server to share files with Windows clients.

    The server will be configured to share files with any client on the network without prompting for a password. If your environment requires stricter Access Controls see the section called “Securing a Samba File and Print Server”

    Installation

    The first step is to install the samba package. From a terminal prompt enter:

    sudo apt-get install samba
    

    That's all there is to it; you are now ready to configure Samba to share files.

    Configuration

    The main Samba configuration file is located in /etc/samba/smb.conf. The default configuration file has a significant amount of comments in order to document various configuration directives.

    [Note]  

    Not all the available options are included in the default configuration file. See the smb.conf man page or the Samba HOWTO Collection for more details.

    1. First, edit the following key/value pairs in the [global] section of /etc/samba/smb.conf:

         workgroup = EXAMPLE
         ...
         security = user
      

      The security parameter is farther down in the [global] section, and is commented by default. Also, change EXAMPLE to better match your environment.

    2. Create a new section at the bottom of the file, or uncomment one of the examples, for the directory to be shared:

      [share]
          comment = Ubuntu File Server Share
          path = /srv/samba/share
          browsable = yes
          guest ok = yes
          read only = no
          create mask = 0755
      
      • comment: a short description of the share. Adjust to fit your needs.

      • path: the path to the directory to share.

        This example uses /srv/samba/sharename because, according to the Filesystem Hierarchy Standard (FHS), /srv is where site-specific data should be served. Technically Samba shares can be placed anywhere on the filesystem as long as the permissions are correct, but adhering to standards is recommended.

      • browsable: enables Windows clients to browse the shared directory using Windows Explorer.

      • guest ok: allows clients to connect to the share without supplying a password.

      • read only: determines if the share is read only or if write privileges are granted. Write privileges are allowed only when the value is no, as is seen in this example. If the value is yes, then access to the share is read only.

      • create mask: determines the permissions new files will have when created.

    3. Now that Samba is configured, the directory needs to be created and the permissions changed. From a terminal enter:

      sudo mkdir -p /srv/samba/share
      sudo chown nobody.nogroup /srv/samba/share/
      
      [Note]  

      The -p switch tells mkdir to create the entire directory tree if it doesn't exist. Change the share name to fit your environment.

    4. Finally, restart the samba services to enable the new configuration:

      sudo restart smbd
      sudo restart nmbd
      
    [Warning]  

    Once again, the above configuration gives all access to any client on the local network. For a more secure configuration see the section called “Securing a Samba File and Print Server”.

    From a Windows client you should now be able to browse to the Ubuntu file server and see the shared directory. To check that everything is working try creating a directory from Windows.

    To create additional shares simply create new [dir] sections in /etc/samba/smb.conf, and restart Samba. Just make sure that the directory you want to share actually exists and the permissions are correct

  • 相关阅读:
    不断学习和思考让自己成长、过得充实快乐!
    先制订个能力提升计划
    如何删除SQL Server下注册的服务器
    [转摘] 我的同学聚会--性格决定命运
    如何提高阅读速度2
    Oracle IW,WW的区别
    想象5年后的你(很多人看了很受启迪!)
    女要富养
    5年内买车买房(理财篇)
    [转摘] 从月薪3500到身价700万 我在上海的奋斗岁月
  • 原文地址:https://www.cnblogs.com/hshuzhao/p/2910364.html
Copyright © 2011-2022 走看看