Samba配置
1. 安装samba
1 2
| sudo apt install samba yum install samba -y
|
2. 配置
指定账号的访问
选择一个共享路径,假设为/home/work/share,不存在的情况下可以自己创建
1
| sudo mkdir -p /home/work/share
|
添加一个可访问用户到Ubuntu系统中,如smbuser,若存在则不需要创建
1
| sudo useradd smbuser -s /usr/sbin/nologin
|
修改文件权限使得smbuser用户能够访问共享路径
1
| sudo chown smbuser:smbuser /home/work/share
|
将用户smbuser添加到samba的smbpasswd file中(即在samba服务中注册该账户)
1 2
| sudo smbpasswd -a smbuser
|
修改samba配置文件(/etc/samba/smb.conf)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| [global] workgroup = WORKGROUP security = user log level=2 ntlm auth = yes log file = /var/log/samba/log.%m
[file] comment = file path = /file public = yes writable = yes browseable = yes valid users = ai directory mask = 0775 create mask = 0775
|
1
| systemctl stop firewalld.service
|
1 2 3 4
| systemctl start smb
sudo service smbd start
|
辅助命令
1 2 3 4 5 6 7 8
| pdbedit -L
smbpasswd -h
cat /var/log/samba/log.%m
|
Windows清除smb认证信息
cmd执行
控制面板 - 用户账户 - 凭据管理器 - 管理windows凭据