我有两个 Samba 共享。一个是公共的(本地网络),任何人都可以查看和更改,这很好用。我还有另一个共享,我希望输入用户名和密码
[media]
comment = public share
path = /mnt/media_files
public = yes
read only = no
writeable = yes
create mask = 0777
directory mask = 0777
force user = nobody
force group = nogroup
guest ok = yes
[webroot]
comment = Apache web root folder
path = /var/www
public = yes
read only = no
writable = yes
create mask = 0777
directory mask = 0777
guest ok = no
我确实也使用过“强制用户=jon”,但似乎没有帮助。
我目前遇到的问题是,当我进入共享“\myip\webroot”时,弹出窗口要求输入密码,但用户名显示为“ip\Guest”。我该如何让它允许我输入用户名,或者强制它只使用“jon”。
在修复 smpasswd 部分的问题后,从 Windows7 计算机登录似乎效果更好。我将密码设置为与 W7 计算机上的用户名帐户相同,一切正常。其他计算机有点问题,必须使用 ip\jon 登录,否则它会将域设置为该计算机的名称。
TestParm 输出:
[global]
server string = %h server (Samba, Ubuntu)
security = SHARE
map to guest = Bad User
obey pam restrictions = Yes
passdb backend = tdbsam
pam password change = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
unix password sync = Yes
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
dns proxy = No
usershare allow guests = Yes
panic action = /usr/share/samba/panic-action %d
[media]
comment = public share
path = /mnt/media_files
force user = nobody
force group = nogroup
read only = No
create mask = 0777
directory mask = 0777
guest ok = Yes
[webroot]
comment = Apache web root folder
path = /var/www
valid users = jon
force user = jon
read only = No
create mask = 0777
directory mask = 0777
guest ok = Yes
答案1
好吧,我不太确定我是否正确完成了您想要的设置。但我会尝试这个:
[global]
...
security = user
guest account = jon
[webroot]
comment = Apache web root folder
path = /var/www
read only = No
create mask = 0777
directory mask = 0777
guest ok = Yes
如果我没有提供 webroot 的密码 => 我是 jon
如果我登录,我就是已登录的用户(请不要忘记smbpasswd
对于每个想要启用 samba 访问权限的 unix 用户。