1、安装:apt update && apt install samba

2、新建账户:

# 接着输入密码(账户必须是系统已存在的)
smbpasswd -a username

# 列出现有 Samba 用户列表
pdbedit -w -L

3、配置:

nano /etc/samba/smb.conf

# === Global Settings  ===
interfaces = lo eth0 wlan0
max log size = 100
# 优化参数
load printers = no
use sendfile = yes
read size = 65535
read prediction = yes
#socket options = TCP_NODELAY SO_RCVBUF=65535 SO_SNDBUF=65535
read raw = yes
write raw = yes
max xmit = 65535
aio read size = 16384
aio write size = 16384
dead time = 5
dns proxy = no
encrypt passwords = yes

max connections = 0
security = user

display charset = UTF-8
unix charset = UTF-8
dos charset = cp936

# === Share Definitions ===
# 共享名称
[disk1]

# 共享目录路径
path = /disk1

# yes/no 指定该共享是否在网上邻居中可见
browseable = yes

# yes/no 指定共享目录为只读(不要与 writable 有冲突)
#read only = yes

# yes/no 指定该共享是否可用
available = yes

# yes/no 指定该共享目录是否可写
writable = yes

# yes/no 是否允许 guest 账户访问
public = no

# yes/no 意义同 public
guest ok = no

# 允许写入该共享的用户
write list = username

# 允许访问该共享的用户或组“@+组名”
valid users = username

# 禁止访问该共享的用户与组(同上)
invalid users = username

# 指定该共享的管理员(用户验证方式为“security=share”时,此项无效)
admin users = username

最后重启:systemctl restart smbd

Last modification:July 21st, 2020 at 09:53 am
如果觉得我的文章对你有用,请随意赞赏