Samba 共享文件访问被拒绝

Samba 共享文件访问被拒绝

我已经按照这个页面设置了 Samba 服务器https://wiki.ubuntuusers.de/Samba_Server/

我做了什么:

1. sudo apt-get install samba-common samba
2. sudo  adduser --no-create-home <username> 
3. sudo smbpasswd -a <username>
4. mkdir /mnt/FILESERVER

我的 /etc/samba/smb.conf 看起来像

[global]
workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
netbios name = HoloFileServer
wins support = yes
dns proxy = no
name resolve order = lmhosts host wins bcast

interfaces = enp3s0
bind interfaces only = yes

log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0

panic action = /usr/share/samba/panic-action %d

server role = standalone server
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

pam password change = yes
map to guest = bad user

usershare allow guests = yes

#======================= Share Definitions =======================

## my Shared
[Shared]
writeable = yes
path = /mnt/RAID/FILESERVER/
comment = Fileserver
guest account = <username>
wide links = no
security = user

尝试从 Windows 访问 \fileServer\Share 时显示“访问被拒绝”

是不是缺少了什么?

(我也已经尝试过了chwon <username>:<usergroup> /mnt/FILESERVER

编辑:
- 根据建议对 adduser 选项应用更改
- 更改了 smb.conf

答案1

通过使用开关添加您的用户,--disabled-login结果正如从添加用户手册页中摘录的那样。

 --disabled-login
              Do  not  run passwd to set the password.  The user won't be able
              to use her account until the password is set.

我不相信smbpasswd -a它能像您想象的那样工作,正如 smbpasswd 手册页中的摘录所示。

 Note that the
           default passdb backends require the user to already exist in the
           system password file (usually /etc/passwd), else the request to add
           the user will fail.

我相信,您可以通过为相关帐户创建密码来解决自己造成的大多数问题sudo passwd <username>

我认为可能与你的困难有关的另一个问题是使用--shell /bin/false据我所知,直接断开连接,没有任何解释

资料来源:

man adduser

man smbpasswd

man passwd

https://unix.stackexchange.com/questions/10852/whats-the-difference-between-sbin-nologin-and-bin-false

相关内容