1、准备:
官网下载安装包,可在https://download.samba.org下载,当前最新版本下载链接
https://download.samba.org/pub/samba/rc/samba-4.12.0rc4.tar.gz

安装依赖包:

2、解压安装包并安装:
tar -xzvf samba-4.12.0rc4.tar.gz
cd /samba-4.12.0rc4
./configure --prefix=/Samba
make &&make install
make clean
3、配置
配置后重启服务。
创建共享目录,并且赋予相应用户相应的权限,用户已经在系统中创建,能在/etc/passwd中找到
mkdir -P /data/share chown -R test.user /data/share
设置访问samba密码
./smbpasswd -a test
配置文件在安装目录下的etc文件夹中,为/Samba/etc/smb.conf
[global]
workgroup = MYGROUP
server string = Samba Server Version %v
security = user
passdb backend = tdbsam
load printers = yes
cups options = raw
[homes]
comment = Home Directories
browseable = no
writable = yes
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable = yes
新加共享:
[test1]
comment = test guest share #共享描述
path = /data/share #共享目录
public = yes #允许guest用户访问
writable = yes #允许在heijunma目录下写入
directory mask = 0775 #默认创建目录权限 rwxrwxr_x
create mask = 0775 #默认创建文件权限 rwxrwxr_x
valid users = test.user,root #允许访问该共享的用户
write list = test.user,root #可写入共享的用户列表
browseable = yes #该指定共享目录可浏览
available = yes #该指定共享资源可使用