我正在构建我的第一台家庭服务器,但遇到了 Samba 系统问题。我所有的计算机都可以检测到它,但我收到错误消息,提示我它无法访问。家里的计算机既有 Windows 也有 Linux。这是我的 Samba 设置:
bal]
; General server settings
netbios name = FieldsVille
server string =
workgroup = WORKGROUP
announce version = 5.0
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192
passdb backend = tdbsam
security = user
null passwords = true
username map = /etc/samba/smbusers
name resolve order = hosts wins bcast
wins support = yes
printing = CUPS
printcap name = CUPS
syslog = 1
syslog only = yes
; NOTE: If you need access to the user home directories uncomment the
; lines below and adjust the settings to your hearts content.
[homes]
valid users = %S
create mode = 0600
directory mode = 0755
browseable = yes
read only = no
veto files = /*.{*}/.*/mail/bin/
; NOTE: Only needed if you run samba as a primary domain controller.
; Not needed as this config doesn't cover that matter.
[netlogon]
path = /var/lib/samba/netlogon
admin users = Administrator
valid users = %U
read only = no
; NOTE: Again - only needed if you're running a primary domain controller.
[Profiles]
path = /var/lib/samba/profiles
valid users = %U
create mode = 0600
directory mode = 0700
writeable = yes
browseable = yes
; NOTE: Inside this place you may build a printer driver repository for
; Windows - I'll cover this topic in another HOWTO.
[print$]
path = /var/lib/samba/printers
browseable = yes
guest ok = yes
read only = yes
write list = root
create mask = 0664
directory mask = 0775
[printers]
path = /tmp
printable = yes
guest ok = yes
browseable = no
; Uncomment if you need to share your CD-/DVD-ROM Drive
;[DVD-ROM Drive]
;path = /media/cdrom
;browseable = yes
;read only = yes
;guest ok = yes
[MyFiles]
path = /home/robert/main
browseable = yes
read only = no
guest ok = yes
create mask = 0644
directory mask = 0755
force user = YOUR_USERNAME
force group = YOUR_USERGROUP
另外,是否有人知道任何其他可能的程序来设置服务器的文件共享?
答案1
你使用的是真实服务器还是只是在桌面系统中安装了 Samba 包?在我的计算机上,我使用这个简单的脚本添加了 Samba 配置:
[ISO_Linux]
路径 = /home/teluk/iso
客人同意 = 可以
只读 = 否
可浏览 = 是
确保你的目录权限设置为每个人都可以访问,但不要设置可写权限。此示例命令可使你的共享目录可访问但不可写:
sudo chmod -R 755 /home/teluk/iso
之后使用以下命令重新启动 smbd 和 nmd:
sudo /etc/init.d/smbd 重启 && sudo /etc/init.d/nmbd 重启
如果你使用带有 samba 的 Ubuntu 桌面,请打开你的文件管理器,如 nautilus、pcmanfm、thunar 等。按 ctrl+L 并输入以下内容进行检查:
smb://本地主机
如果完成后,共享目录显示在您的文件管理器中,接下来您可以尝试通过按 windows_button+R 然后输入 //your_ip 在 windows 系统中访问您的 samba。
祝你好运 。
注意:“/home/teluk”可能是您的主目录,您可以使用目录位置来更改它。
答案2
不确定您是否正在使用默认的 smb.conf,该配置是否易于设置。我建议先进行调试。
您还需要sudo smbpasswd -a <user>
为每个需要登录的用户运行(我通常都必须这样做)。
应该有一个默认smb.conf
值/usr/share/samba/smb.conf