centos7配置samba

  1. 开放端口
    确认自己本地的iptable 或者firewalld,打开对应的端口。
    如果是阿里云,还要开启对应ecs的安全组端口配置。
    建议:
    UDP 137-138
    TCP:139 445
  2. 确认SELinux的相关权限设置
    在没搞明白之前,先关闭,等调试通了后再开启,根据相关的问题来配置。不建议粗暴的关闭。
  3. 安装 samba
yum install samba
systemctl enable smb
systemctl start smb
  1. 创建用户

– 创建用户组
groupadd dev
– 创建用户
useradd -g dev aaa
– 设置用户的密码
passwd aaa
– 将用户添加到samba账号中
smbpasswd -a aaa
5. 配置samba
/etc/samba/smb.conf
参考配置:

# See smb.conf.example for a more detailed config file or
# read the smb.conf manpage.
# Run 'testparm' to verify the config is correct after
# you modified it.

[global]
        workgroup = SAMBA
        security = user

        passdb backend = tdbsam

        printing = cups
        printcap name = cups
        load printers = yes
        cups options = raw
        map to guest = Bad User
        log file = /var/log/samba/log.%m
[homes]
        comment = Home Directories
        browseable = no
        writable = yes
[public]
        comment = Public Stuff
        path = /data/share
        public = yes
[dev]
        comment = developer
        path = /dev
        valid users = @dev
  1. 参考
    https://www.cnblogs.com/muscleape/p/6385583.html
    https://wiki.centos.org/HowTos/SetUpSamba