5

Samba配置Standalone Server

 3 years ago
source link: https://segmentfault.com/a/1190000039855034
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

在小型网络中,例如家庭网络、或在非域主机中共享目录,通常你不想设置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 demoUser
Enter new UNIX password: Passw0rd
Retype new UNIX password: Passw0rd
passwd: password updated successfully
  • 将demoUser账户添加到Samba数据库:
# smbpasswd -a demoUser
New SMB password: Passw0rd
Retype new SMB password: Passw0rd
Added user demoUser.

本地用户组管理

创建共享目录

为共享目录设置ACL

测试共享访问权限

[1] Setting up Samba as a Standalone Server


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK