Windows 10 无法连接 Samba4 服务器

Windows 10 无法连接 Samba4 服务器

我的 Samba 服务器出现了问题。我有一个 Samba 服务器,但配置非常老旧,所以我重新安装了操作系统 (Debian 5.10.140-1) 和 Samba (Samba 版本 4.13.13)。但现在所有装有 Win10 的计算机都无法连接到服务器。我收到以下消息:

设备或资源(nameServer)未配置为接受“文件和打印机共享 (SMB)”端口上的连接。

我尝试了很多方法让它工作,但都没有用。以下是我的 smb.conf

[global]
    netbios name = SMBSHARE
    server string = Compartilhamento
    workgroup = MYGROUP
    smb ports = 139
    security = user
    wins support = yes
    dns proxy = no
    os level = 100
    auto services = global
    name resolve order = lmhosts, host, wins, bcast
    cups options = raw
    load printers = yes
    interfaces = lo eth1 192.168.1.0/24
    hosts allow = 127. 192.168.1.
    passdb backend = tdbsam
    ntlm auth = yes
    preferred master = yes
    domain master = yes
    logon path = %Nprofile%u
    invalid users = root
    server min protocol = NT1
    #client max protocol = SMB3_11

        ### Log Config ###
    #log file = /var/log/samba/log.%m
    #log level = 5
    #max log size = 500
    #syslog = 5



[printers]
    comment = All Printers
    browseable = yes
    path = /var/spool/samba
    printable = yes
    public = yes
    writable = no
    guest ok = yes
    use client driver = yes


# ============ Shared Directories ===========
[Public]
    comment = Diretorio Publico
    path = /home/share/Public_file
    public = yes
    writable = yes
#   guest ok = yes
    guest only = yes
    browseable = yes
    printable = no
    write list = +staff
    force create mode = 775
    force directory mode = 775

[Private Share]
    comment = Diretorio Compartilhado
    path = /home/share/Private_share
    public = no
    writable = yes
#   guest ok = no
    valid users = adminrh
    force create mode = 770
    force directory mode = 770
    ;inherit permissions = yes

我有一些来自计算机的日志,我想记录它们:

[...]
[2022/10/21 16:06:31.009658,  5] ../../lib/util/debug.c:811(debug_dump_status)
  INFO: Current debug levels:
    all: 5
    tdb: 5
    printdrivers: 5
    lanman: 5
    smb: 5
    rpc_parse: 5
    rpc_srv: 5
    rpc_cli: 5
    passdb: 5
    sam: 5
    auth: 5
    winbind: 5
    vfs: 5
    idmap: 5
    quota: 5
    acls: 5
    locking: 5
    msdfs: 5
    dmapi: 5
    registry: 5
    scavenger: 5
    dns: 5
    ldb: 5
    tevent: 5
    auth_audit: 5
    auth_json_audit: 5
    kerberos: 5
    drs_repl: 5
    smb2: 5
    smb2_credits: 5
    dsdb_audit: 5
    dsdb_json_audit: 5
    dsdb_password_audit: 5
    dsdb_password_json_audit: 5
    dsdb_transaction_audit: 5
    dsdb_transaction_json_audit: 5
    dsdb_group_audit: 5
    dsdb_group_json_audit: 5
[2022/10/21 16:06:31.010658,  4] ../../source3/smbd/sec_ctx.c:319(set_sec_ctx_internal)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 0
[2022/10/21 16:06:31.010716,  5] ../../libcli/security/security_token.c:52(security_token_debug)
  Security token: (NULL)
[2022/10/21 16:06:31.010741,  5] ../../source3/auth/token_util.c:873(debug_unix_user_token)
  UNIX token of user 0
  Primary group is 0 and contains 0 supplementary groups
[2022/10/21 16:06:31.010782,  5] ../../source3/smbd/uid.c:493(smbd_change_to_root_user)
  change_to_root_user: now uid=(0,0) gid=(0,0)
[...]
[2022/10/21 16:06:32.668102,  5] ../../source3/lib/util.c:188(show_msg)
  size=39
  smb_com=0x74
  smb_rcls=0
  smb_reh=0
  smb_err=0
  smb_flg=24
  smb_flg2=51223
  smb_tid=0
  smb_pid=65279
  smb_uid=41336
  smb_mid=448
  smt_wct=2
  smb_vwv[ 0]=  255 (0xFF)
  smb_vwv[ 1]=    0 (0x0)
  smb_bcc=0
[2022/10/21 16:06:32.668204,  3] ../../source3/smbd/process.c:1548(switch_message)
  switch message SMBulogoffX (pid 348933) conn 0x0
[2022/10/21 16:06:32.668250,  4] ../../source3/smbd/sec_ctx.c:319(set_sec_ctx_internal)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 0
[2022/10/21 16:06:32.668293,  5] ../../libcli/security/security_token.c:52(security_token_debug)
  Security token: (NULL)
[2022/10/21 16:06:32.668315,  5] ../../source3/auth/token_util.c:873(debug_unix_user_token)
  UNIX token of user 0
  Primary group is 0 and contains 0 supplementary groups
[2022/10/21 16:06:32.668353,  5] ../../source3/smbd/uid.c:493(smbd_change_to_root_user)
  change_to_root_user: now uid=(0,0) gid=(0,0)
[2022/10/21 16:06:32.668393,  5] ../../lib/dbwrap/dbwrap.c:146(dbwrap_lock_order_lock)
  dbwrap_lock_order_lock: check lock order 1 for /run/samba/smbXsrv_session_global.tdb
[2022/10/21 16:06:32.668432,  5] ../../lib/dbwrap/dbwrap.c:178(dbwrap_lock_order_unlock)
  dbwrap_lock_order_unlock: release lock order 1 for /run/samba/smbXsrv_session_global.tdb
[2022/10/21 16:06:32.668475,  3] ../../source3/smbd/reply.c:2820(reply_ulogoffX_done)
  reply_ulogoffX_done: ulogoffX vuid=41336
[2022/10/21 16:06:32.669380,  5] ../../source3/lib/util_sock.c:133(read_fd_with_timeout)
  read_fd_with_timeout: blocking read. EOF from client.
[2022/10/21 16:06:32.669409,  5] ../../source3/smbd/process.c:555(receive_smb_talloc)
  receive_smb_raw_talloc failed for client ipv4:192.168.1.89:49822 read error = NT_STATUS_END_OF_FILE.
[...]
[2022/10/21 16:06:32.670391,  3] ../../source3/smbd/server_exit.c:220(exit_server_common)
  Server exit (failed to receive smb request)

我看到几年前有人遇到过同样的问题

无法从 Windows 10 连接到 Linux Samba 共享也就是说Win10不能Samba4不能支持SMB3_11。但是这个版本的SMB有这种连接的支持。下面是一些连接到服务器的版本。

PID     Username     Group        Machine                                   Protocol Version  Encryption           Signing 
43041   admin        admin        yuri (ipv4:192.168.1.127:56284)           SMB3_11           -                    partial(AES-128-CMAC)
342734  admin        admin        server2 (ipv4:192.168.1.195:49354)        NT1               -                    -                    
342633  admin        admin        helen-pc (ipv4:192.168.1.123:50786)       SMB2_10           -                    -                    

我该如何解决这个问题?

答案1

您的“公共”共享很有趣,因为您尚未打开访客访问权限,您需要在“全局”中“映射到访客 = 坏用户”

我会删除“smb ports = 139”行,您已关闭“445”,我还会删除所有与 SMBv1 相关的行,除非您确实需要它们用于某些旧机器。您还应该检查 Windows 10 机器是否没有通过防火墙阻止访问。

相关内容