Samba Setting

本文详细介绍如何在Linux系统中配置SMB服务实现文件共享,包括防火墙设置、SMB配置文件修改、服务重启及挂载操作等步骤。

Linux 工具Share文件

    SMB(Server Message Block)服务信息块

    service smb restart

    service nmb restart

    

    操作说明:

        window 用户名:lidong 密码:1

        linux 用户名:linux 密码:1 (这个简单的例子没用到)

    准备工作:

        在windows下 创建一个共享文件夹 share

        在linux 下 创建目录文件mkdir -p /home/share

    关掉防火墙:

         1) 重启后永久性生效:

              开启: chkconfig iptables on

              关闭: chkconfig iptables off

          2) 即时生效,重启后失效:

              开启: service iptables start

              关闭: service iptables stop

    具体操作:

        1. cd /etc/samba/

        2. mv smb.conf smb.conf_bak

        3. vim smb.conf

            [global]    

            workgroup = project

            "netbios name = dolphin

            server string = Linux Samba Server Share

            security = share

 

            [vmshare]

        path = /home/share

        writeable = yes

        "browseable = yes

        guest ok = yes

    4. smbd

    5. nmbd

    6. mount -o codepage=cp936,username=lidong,password=1,-l //172.16.61.1/share /home/share (注意:lidong,password没有空格)

7. (附加)将window上的share文件映射为网络驱动器,方便访问

8. 开机自动挂载:vim /root/.bashrc

         #!/bin/sh

         mount -o codepage=cp936,username=lidong,password=1,-l //172.16.61.1/share /home/share

         smbd

         nmbd

 

### Samba Server Administration Guide and Best Practices #### Overview of Samba Configuration Samba configuration primarily revolves around the `smb.conf` file, which controls all aspects of how a Samba server operates. This includes sharing settings, security policies, user management, and more[^1]. The main sections within this file are `[global]`, defining global parameters applicable to all shares; specific share definitions that start with square brackets followed by the name of the share. #### Setting Up Shares To set up shared directories on a Linux system using Samba involves editing the `/etc/samba/smb.conf`. For example, adding a new section like below allows users to access a directory named 'public': ```ini [Public Share] path = /srv/public browsable = yes read only = no guest ok = yes create mask = 0755 directory mask = 0755 ``` This setup creates an open-access folder where anyone can read/write files without needing authentication credentials provided guest access is enabled. #### User Management Managing users requires creating Unix accounts first before setting them as valid Samba users via `smbpasswd -a username`. It's also possible to integrate Active Directory or LDAP services for centralized account control over multiple servers. #### Security Considerations Security measures include restricting network interfaces through which connections may occur (`interfaces = eth0`) and limiting allowed hosts (`hosts allow`). Additionally, enforcing strong passwords and regularly updating software helps protect against vulnerabilities. #### Performance Optimization Tips For better performance, consider tuning buffer sizes (`socket options`), enabling oplocks (opportunistic locking) when clients support it, adjusting log levels appropriately so they do not consume too many resources while still providing useful information during troubleshooting sessions. --related questions-- 1. How does one configure advanced features such as ACLs in Samba? 2. What steps should be taken to migrate from Windows File Services to Samba? 3. Can you explain how to implement roaming profiles using Samba? 4. In what scenarios would integrating Kerberos into my Samba environment benefit me?
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值