一分钟搭建samba服务

427 阅读1分钟

运行yum install -y samba安装samba.

一. 创建linux用户

groupadd smbshare
useradd -g smbshare share
passwd share

二. 创建samba用户

smbpasswd -a share

三. 创建目录

mkdir /home/smbshare
chgrp -R smbshare /home/smbshare
chmod g+w smbshare/

四. 修改配置文件

cp /etc/samba/smb.conf /etc/samba/smb.confbak

vim /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
        map to guest = Bad User
        log file = /var/log/samba/log.%m

[shares]
        comment = share
        path = /home/smbshare
        # 表示用户组
        valid users = @smbshare
        read only = No

五.重启samba服务

systemctl restart smb

六. 登录

访问\\192.168.1.202\shares地址

使用share/share用户名/密码登录