介绍

在小型网络中,例如家庭网络、或在非域主机中共享目录,通常你不想设置AD域或NT4域。本文形容了如何配置Samba作为独立服务:

  • 容许匿名拜访的共享;
  • 反对Samba本地用户认证的共享;

配置访客拜访的根底smb.conf

如下配置为,仅容许访客拜访的最小化配置。

[global]        map to guest = Bad User        log file = /var/log/samba/%m        log level = 1[guest]        # This share allows anonymous (guest) access        # without authentication!        path = /srv/samba/guest/        read only = no        guest ok = yes        guest only = yes

创立认证拜访的根底smb.conf

如下配置为,Samba作为Standlone server的最小化配置。

[global]        log file = /var/log/samba/%m        log level = 1[demo]        # This share requires authentication to access        path = /srv/samba/demo/        read only = no

创立本地用户账户

  • 在本地零碎创立一个 demoUser 账户:
# useradd -M -s /sbin/nologin demoUser
  • 在本地系统启动demoUser账户:
# passwd demoUserEnter new UNIX password: Passw0rdRetype new UNIX password: Passw0rdpasswd: password updated successfully
  • 将demoUser账户增加到Samba数据库:
# smbpasswd -a demoUserNew SMB password: Passw0rdRetype new SMB password: Passw0rdAdded user demoUser.

本地用户组治理

创立共享目录

为共享目录设置ACL

测试共享拜访权限

材料起源

[1] Setting up Samba as a Standalone Server