如何配置Linux Samba服务器

简介

Samba是一种可以在Linux和UNIX系统中实现SMB/CIFS协议的软件,它允许用户通过网络共享文件和打印机,本文将详细介绍如何配置Linux Samba服务器,包括安装、配置文件、用户管理等方面的内容。

安装Samba

1、更新系统软件包列表:

如何配置Linux Samba服务器

sudo apt-get update

2、安装Samba及其相关工具:

sudo apt-get install samba samba-common-bin

3、安装完成后,启动Samba服务:

sudo systemctl start smbd nmbd nmbdadm

4、设置开机自启动:

sudo systemctl enable smbd nmbd nmbdadm

配置文件

1、Samba的主配置文件位于/etc/samba/smb.conf,可以使用文本编辑器进行编辑:

sudo nano /etc/samba/smb.conf

2、在配置文件中,可以设置以下参数:

workgroup:工作组名称,与Windows系统的相同;

如何配置Linux Samba服务器

server string:服务器描述;

netbios name:网络基本输入输出系统(NetBIOS)名称;

security modes:安全模式,如user、share、domain;

encrypt passwords:是否加密密码;

map to guest account:是否映射到guest账户;

max log size:日志文件最大大小;

如何配置Linux Samba服务器

logging levels:日志记录级别;

socket options:套接字选项;

idmap config file:ID映射配置文件;

[share]共享名:共享目录的配置信息,如路径、权限等。

以一个简单的示例为例:

[global]
   workgroup = WORKGROUP
   server string = Samba Server %v
   netbios name = centos
   security = user
   encrypt passwords = yes
   map to guest account = bad user
   max log size = 100M
   logging levels = debug,notice,info,warnings,error
   socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536 SO_KEEPALIVE=YES NO_ROOT_SCANNING=1 Tcp_Keepalive_Time=1200 TCP_USER_TIMEOUT=300 TCP_KEEPIDLE=600 Idle_Time=3000 TCP_RECV_TIMEOUT=300 TCP_REUSEADDR=1 TCP_SYNCNT=1 TCP_LINGER2=15 UDP_CONNRESET=1 PROTOCOLS=TCP UDP IPV4_FAILURE_FATAL=no IPV6_FAILURE_FATAL=no REUSEPORT=yes UNIX_PATH_MODE=0777 Samba Master Browser Style=master browser unix group=wheel home dir=%h web disk_size=1024M max log size=10485760 write list=@admin vfat umask=0002 local time sync waittime=3600 logon time=24 hours passwd chat=off isroaming=off force chroot=off template homedir=%h force user=centos no create mask=0777 winbind use default domain=\\SERVERNAME audit failed attempts failauth retries minrate rate limit auth users read only = no list = @users read list = @readusers write list = @writeusers force group = admins force user = centos force mech = plain public ok username map = none hide full path = no valid users = @validusers force public = yes writable acl = nodev unbind defeauls acl add speciality=masked acl add speciality=system acl add speciality=hidden acl add speciality:speciality deny rwx execute disable setuid setgid sticky bit mode mask=0x0f00 mask2=0x1f00 mask3=0x2700 mask4=0x3f00 extended rights mask=0x1ffffffff mask2=0x1fffffe mask3=0x1ffffffe mask4=0x1fffffffe extended attributes mask=none relabel mask=none label mask=none allow root = cifs deny root = cifs hosts allow = * deny = * hosts deny = ALL hosts allow = %s local master = no local master = %s workgroup = WORKGROUP shared folder = %s comment = This is a Samba share on %s network drive read only = no browseable = yes guest ok = yes writable = yes read only = no force user = nobody force group = nobody public = yes anon quota maxbytes = unlimited anon quota days = unlimited anon quota users = nobody anon quota roots = nobody anon quota soft limits = unlimited anon quota hard limits = unlimited writable acl add speciality:speciality deny rwx execute disable setuid setgid sticky bit mode mask=0x0f00 mask2=0x1f00 mask3=0x2700 mask4=0x3f00 extended rights mask=0x1ffffffff mask2=0x1fffffe mask3=0x1ffffffe mask4=0x1fffffffe extended attributes mask=none relabel mask=none label mask=none allow root = cifs deny root = cifs hosts allow = * deny = * hosts deny = ALL hosts allow = %s local master = no local master = %s workgroup = WORKGROUP shared folder = %s comment = This is a Samba share on %s network drive read only = no browseable = yes guest ok = yes writable = yes read only = no force user = nobody force group = nobody public = yes anon quota maxbytes = unlimited anon quota days = unlimited anon quota users = nobody anon quota roots = nobody anon quota soft limits = unlimited anon quota hard limits = unlimited writable acl add speciality:speciality deny rwx execute disable setuid setgid sticky bit mode mask=0x0f00 mask2=0x1f00 mask3=0x2700 mask4=0x3f00 extended rights mask=0x1ffffffff mask2=0x1fffffe mask3=0x1ffffffe mask4=0x1fffffffe extended attributes mask=none relabel mask=none label mask=none allow root = cifs deny root = cifs hosts allow = * deny = * hosts deny = ALL hosts allow = %s local master = no local master = %s workgroup = WORKGROUP shared folder = %s comment = This is a Samba share on %s network drive read only = no browseable = yes guest ok

原创文章,作者:K-seo,如若转载,请注明出处:https://www.kdun.cn/ask/210464.html

Like (0)
Donate 微信扫一扫 微信扫一扫
K-seo的头像K-seoSEO优化员
Previous 2024-01-11 03:44
Next 2024-01-11 03:47

相关推荐

  • Linux怎么修改root密码

    Linux系统以其稳定性、安全性和易用性受到了许多用户的喜爱,为了保证系统的安全性,root用户默认是禁用的,普通用户需要通过一定的权限才能访问,在某些情况下,可能需要修改root用户的密码,以便管理员能够更方便地管理系统,本文将详细介绍如何在Linux系统中修改root密码。修改root密码的方法1、重启计算机在修改root密码之前……

    2024-01-17
    0199
  • linux扫描新增磁盘,linux识别新增磁盘

    在Linux系统中,扫描新增磁盘和识别新增磁盘的过程通常涉及到两个步骤:首先是使用fdisk -l命令来扫描并列出所有磁盘设备,然后是使用udevadm monitor命令来监控新设备的插入,接下来,我们将详细介绍这两个过程。1、使用fdisk -l命令扫描并列出所有磁盘设备:fdisk -l命令用于列出系统中所有的磁盘分区信息,在终……

    2023-12-10
    0286
  • linux怎么查看当前目录剩余空间的文件

    在Linux系统中,查看当前目录剩余空间是很常见的操作,这可以帮助我们了解磁盘的使用情况,以便及时清理不必要的文件,释放空间,本文将介绍如何在Linux中查看当前目录剩余空间的方法。1. 使用df命令df命令是Linux中最常用的用于查看磁盘空间使用情况的命令,它可以显示磁盘的总空间、已用空间、剩余空间等信息,要查看当前目录的剩余空间……

    2024-01-22
    0273
  • linux删除lv的命令?「linux lv删除」

    在Linux系统中,逻辑卷(Logical Volume)是一种可以动态调整大小的磁盘分区,它是通过卷组(Volume Group)来管理的,有时候,我们可能需要删除某个逻辑卷,例如为了重新分配空间或者清理不再使用的逻辑卷,本文将详细介绍在Linux系统中删除逻辑卷的命令及其操作步骤,以及在执行过程中需要注意的事项。一、删除逻辑卷前的……

    2023-11-06
    0562
  • linux系统防火墙怎么手动关闭

    Linux系统防火墙简介Linux系统防火墙是一种用于保护Linux操作系统安全的工具,它可以控制进出系统的网络连接,防火墙可以阻止未经授权的访问,保护内部网络免受外部网络的攻击,在Linux系统中,有两种常见的防火墙工具:iptables和firewalld,本文将介绍如何手动关闭Linux系统防火墙。如何手动关闭iptables防……

    2023-12-21
    0141
  • linux串口驱动接口怎么配置的

    Linux串口驱动接口的配置是一个相对复杂的过程,需要对Linux内核、设备驱动以及串口通信有一定的了解,本文将详细介绍如何在Linux系统中配置串口驱动接口。1、了解串口通信串口通信是一种基于RS-232标准的通信方式,主要用于计算机与外部设备之间的数据传输,串口通信的主要特点是传输速率较低,但硬件简单,易于实现,在Linux系统中……

    2023-12-27
    0114

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

免备案 高防CDN 无视CC/DDOS攻击 限时秒杀,10元即可体验  (专业解决各类攻击)>>点击进入