安装
yum install -y samba samba-client samba-common
配置
# /etc/samba/smb.conf
[global]
# 主机信息设置
workgroup = WorkGroup
netbios name = Tongji409Server
server string = Samba Server Version %v
log file = /var/log/samba/log.%m
max log size = 50
# 加密设置
security = user
passdb backend = tdbsam
# 不加载打印机
load printers = no
[homes]
comment = Home Directories
# 除用户自己外,不可被他人浏览
browseable = no
# 可以被写入
writable = yes
# 新建文件权限为 664
create mode = 0664
# 新建目录权限为 775
directory mode = 0775
[Public]
comment = Public Resource
path = /home/Public
browseable = yes
writable = yes
write list = @smber
设置帐号
groupadd smber # 设置组
useradd -G smber rain # 添加用户
pdbedit -a -u rain # 添加samba用户
smbpasswd rain # 修改samba用户密码(需要的话)
创建共享目录
mkdir /home/Public
chgrp smber /home/Public
chmod 2770 /home/Public
启动
smbd -D