Samba 不工作

Samba 不工作

我正在运行 Ubuntu 18-04

大约一个月前,Samba 停止工作。我猜测这是由于自动更新导致的。

过去一周我一直在认真地做这件事,但没有成功。我已经尽我所能了。

除了我添加的共享之外,我目前正在使用标准 smb 文件:

[Home Share]

comment = Home Public folders
path = /home/mike/
writable = yes
valid users = mike
browseable = yes

我添加到全局设置但没有成功的各种参数组合是:

tls enabled = no
client max protocol = NT1 # I tried these separately, not together
client min protocol = SMB2 # I tried these separately, not together
name resolve order = bcast host lmhosts wins
client NTLMv2 auth = no
client use spnego = no
netbios name = MAIL
preferred master = yes
domain master = yes

一些可能有用的信息:

smbclient -L mail -U mike
WARNING: The "syslog" option is deprecated
Enter WORKGROUP\mike's password: 

Sharename       Type      Comment
---------       ----      -------
print$          Disk      Printer Drivers
Home Share      Disk      Home Public folders
IPC$            IPC       IPC Service (mail server (Samba, Ubuntu))
Brother_MFC_J480DW Printer   Brother MFC-J480DW
Reconnecting with SMB1 for workgroup listing.

Server               Comment
---------            -------

Workgroup            Master
---------            -------
WORKGROUP            MAIL

smbtree
WARNING: The "syslog" option is deprecated
added interface eno1 ip=192.168.1.104 
bcast=192.168.1.255 netmask=255.255.255.0
resolve_lmhosts: Attempting lmhosts lookup for 
name WORKGROUP<0x1d>
name_resolve_bcast: Attempting broadcast 
lookup for name WORKGROUP<0x1d>
resolve_lmhosts: Attempting lmhosts lookup for 
name WORKGROUP<0x1b>
resolve_wins: WINS server resolution selected 
and no WINS servers listed.
name_resolve_bcast: Attempting broadcast l 
lookup for name WORKGROUP<0x1b>
name_resolve_bcast: Attempting broadcast 
lookup for name __MSBROWSE__<0x1>

net ads testjoin
ads_connect: No logon servers are currently 
available to service the logon request.
Join to domain is not valid: No logon servers 
are currently available to service the logon 
request.

日志中的内容如下:

Failed to fetch domain sid for WORKGROUP

[2019/01/10 09:50:20.954660,  3] 
../source3/lib/util_procid.c:54(pid_to_procid)
pid_to_procid: messaging_dgm_get_unique 
failed: No such file or directory

谷歌搜索这些日志条目没有产生任何有意义的结果。所以我没有主意了。任何帮助都将不胜感激。

谢谢你的帮助,切尔诺贝利,我真的很感激。

不幸的是,没有任何变化。以下是 testparm 的输出。/mnt/testshare 目录已创建。

Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit 
(16384)
Processing section "[Test Share]"
Loaded services file OK.
WARNING: socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
This warning is printed because you set one of the
following options: SO_SNDBUF, SO_RCVBUF, SO_SNDLOWAT,
SO_RCVLOWAT
Modern server operating systems are tuned for
high network performance in the majority of situations;
when you set 'socket options' you are overriding those
settings.
Linux in particular has an auto-tuning mechanism for
buffer sizes (SO_SNDBUF, SO_RCVBUF) that will be
disabled if you specify a socket buffer size. This can
potentially cripple your TCP/IP stack.

Getting the 'socket options' correct can make a big
difference to your performance, but getting them wrong
can degrade it by just as much. As with any other low
level setting, if you must make changes to it, make
small changes and test the effect before making any
large changes.

Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

# Global parameters
[global]
dns proxy = No
local master = No
log file = /var/log/samba/%m
map to guest = Bad User
max log size = 50
preferred master = No
security = USER
server string = Samba Server %v
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
idmap config * : backend = tdb


[Test Share]
create mask = 0755
path = /mnt/testshare
read only = No
valid users = mike

我确信问题不在于 smb.conf 文件,而是比这更根本的问题。

答案1

这是我所知道的最简单的 samba 配置。保存旧的 smb.conf 并创建一个与此完全相同的新配置,测试机器现在是否可以访问

[global]
        map to guest = Bad User

        log file = /var/log/samba/%m
        log level = 1
workgroup = your workgroupname
       netbios name = name of your server
       server string = Samba Server %v
        max log size = 50
       socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
       preferred master = No
       local master = No
       dns proxy = No
       security = user

[name of your share]
        path = /mnt/name of your folder where the shared drive is mounted
browseable = yes        
read only = no
        valid users = some username, some other username 
    create mask = 0755
    directory mask = 0755

这样你就可以让用户登录网络并访问共享文件夹

确保您的驱动器和共享文件夹安装在 /mnt/ 而不是您的主文件夹中

如果您能以这样的方式访问请告诉我

之后编辑

如果我是你,我现在会做的是检查挂载点的权限,检查客户端、用户和服务器是否都具有足够的权限,以及配置文件中是否没有错误。我还会确保网络设置具有正确的网关和 DNS 设置等。我真正能建议的就是,你仔细检查配置文件,就像重新设置网络一样。经验告诉我,这个问题与权限有关。至少我的直觉是,共享目录上的所有权或组不正确。如果事实证明这是错误的,我会转到配置文件,但是快速浏览完配置文件后,我看不出其中可能存在什么问题

答案2

好的,我明白了。

sudo service ufw start

我之前允许 Samba 通过防火墙。我不明白禁用防火墙怎么会阻止 Samba 运行。

无论如何,在我让所有共享工作后,我注意到 smbtree 没有产生任何输出。我按照本教程修复了这个问题这里

还有一个关于如何正确设置 Samba 的非常好的教程这里

相关内容