树莓派 SMB共享Samba 安装部署

安装配置Samba
apt-get install samba

修改配置文件/etc/samba/smb.conf
添加以下全局[global]配置

guest account = root
read size = 65536
write cache size = 262144
aio read size = 16384
aio write size = 16384
large readwrite = yes

在最后添加

[sda1]
comment = sda1
path = /mnt/sda1
read only = no
create mask = 0777
directory mask = 0777
guest ok = yes
browseable = yes

启动、停止、重启

/etc/init.d/smbd start | stop | restart
systemctl start | stop | restart smbd.service

Samba用户管理
添加本地用户到Samba,并设置访问密码
smbpasswd -a

删除Samba用户
smbpasswd -x <username>

修改密码
smbpasswd <username>

禁用用户
smbpasswd -d <username>

启用用户
smbpasswd -e <username>

列出所有 Samba 用户
pdbedit -L

查看用户详细信息
pdbedit -v -u <username>

参考:
https://wiki.samba.org/index.php/Setting_up_Samba_as_a_Standalone_Server#Creating_a_Basic_authenticated_access_smb.conf_File