标题: Win10创建匿名共享 创建: 2022-03-01 15:29 链接: https://scz.617.cn/windows/202203011529.txt 服务端是Win10企业版2016 LTSB,winver显示1607(OS Build 14393.4704) 假设C/S两侧都是Win10,只开一个匿名只读共享,不想提供user/pass就访问到,很 多Win9x年代过来的会比较怀念那种匿名共享。Win10时代达到那种效果要比想像的复 杂一些。 先确保Win10可以配置普通共享,参看 《Win10网络共享故障排查表单》 https://scz.617.cn/windows/202110231342.txt 依次做如下检查与实验 (a) 检查445/TCP侦听中 (b) 检查Server服务启动中 (c) 检查Win10自带FW (d) 检查"高级共享设置" (e) 检查网络属性 (f) 检查SMB协议相关安全限制 (g) 开启共享目录 (h) 检查SMB会话 (i) 访问共享目录 假设Win10普通共享创建、访问无误,现在来整Win10匿名共享。 1) 客户端设置 对于现代Win10、Win11客户端来说,为实现客户端不提供user/pass访问服务端共享, 可能需要在客户端做个设置。 为什么说"可能需要"?SMB协议有个"来宾登录"的概念,可以当成任意user/pass建立 SMB会话,该会话拥有Guest权限。从Windows 10 1709开始,通过SMBv2协议访问共享 时客户端缺省禁用不安全的来宾登录,这是个客户端限制,不是服务端限制。 这一步"可能不需要"。对于不了解SMB协议的人,为达目的,管它三七二十一,设上 就对了。 -------------------------------------------------------------------------- gpedit.msc Local Computer Policy Computer Configuration Administrative Templates Network Lanman Workstation Enable insecure guest logons Enabled (缺省是Not Configured,等同于Disabled) -------------------------------------------------------------------------- 启用后立即生效,无需热刷新组策略并重启Workstation服务。恢复成未配置状态, 必须重启Workstation服务使之生效。 为减少干扰,最好是热刷新组策略并重启Workstation服务 gpupdate.exe /force && net stop rdr && net start rdr 2) 服务端设置 -------------------------------------------------------------------------- 创建共享名temp 右键/Security Edit Add Everyone (调整NTFS权限) Read & execute List folder contents Read -------------------------------------------------------------------------- secpol.msc Security Settings Local Policies User Rights Assignment Deny access to this computer from the network 删掉Guest (缺省只有Guest) Security Options Accounts: Guest Account Status Enabled (缺省Disabled) Network access: Sharing and security model for local accounts Guest only - local users authenticate as Guest (必须调整成这种) -------------------------------------------------------------------------- lusrmgr.msc Users Guest Set Password 设为空口令 (必须为空) -------------------------------------------------------------------------- control Network and Sharing Center Change advanced sharing settings Guest or Public (current profile) File and printer sharing Turn on file and printer sharing All Networks Password protected sharing Turn off password protected sharing (必须调整成这种) -------------------------------------------------------------------------- Guest账号启用后,缺省口令为空。 Guest口令不为空时,无法保持"Turn off password protected sharing"。 不建议只重启Server服务,应重启服务端OS后测试。若实在不想重启服务端OS,至少 要热刷新组策略 gpupdate.exe /force && net stop srv && net start srv 3) 服务端无关设置 客户端不提供user/pass访问服务端共享,与这些服务端设置"无关" -------------------------------------------------------------------------- secpol.msc Security Settings Local Policies User Rights Assignment Access this computer from the network Security Options Network access: Do not allow anonymous enumeration of SAM accounts Network access: Do not allow anonymous enumeration of SAM accounts and shares Network access: Let Everyone permissions apply to anonymous users Network access: Restrict anonymous access to Named Pipes and Shares Network access: Shares that can be accessed anonymously -------------------------------------------------------------------------- control Network and Sharing Center Change advanced sharing settings All Networks Public folder sharing Turn on sharing so anyone with network access can read and write files in the Public folders -------------------------------------------------------------------------- Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa] "everyoneincludesanonymous"=dword:00000000 "restrictanonymous"=dword:00000001 "restrictanonymoussam"=dword:00000001 "LimitBlankPasswordUse"=dword:00000001 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters] "restrictnullsessaccess"=dword:00000001 "NullSessionPipes"=hex(7):00,00 "NullSessionShares"=- -------------------------------------------------------------------------- "无关"是说随便设,不影响原始需求。 打开"Public folder sharing"只是将"C:\Users"共享出去。 4) 相当于任意user/pass建立Guest会话 满足原始需求时,实际相当于任意user/pass都能建立SMB会话,该会话拥有Guest权 限,这也是"来宾登录"的意义所在。 net use * /d /y net use \\\ipc$ "any" /u:"some" net use \\\ipc$ "any" /u:"domain\some" "来宾登录"应该是XP首次引入,当时给极光扫描插件带来麻烦。有个弱口令检查,面 对配置过"来宾登录"的服务端,会误报,当年是SMBv1插件,时间久远,都忘了这茬。 但这种配置不足以建立空会话,下列操作可能报"拒绝访问" net use \\\ipc$ "" /u:"" 5) Wireshark抓包 无预设SMB会话的前提下直接访问UNC路径,抓包看到"SMB2 Session Setup Request NTLMSSP_AUTH"直接成功,不会失败。 6) 应用场景 原始需求是有一些正常应用场景的。比如家庭环境中,有一台电影服务器,希望每台 接入家庭局域网的电脑能无感直接访问电影服务器,无需提供user/pass,无需提前 建立SMB会话,只需提供UNC路径。 7) 匿名共享打印机 为实现匿名共享打印机,除了前面的服务端设置,还得做些其他设置 -------------------------------------------------------------------------- control Devices and Printers 右键选中打印机 Properties Sharing Share this printer (勾中) Share name Render print jobs on client computers (勾中) Security Everyone Print Manage this printer Manage documents --------------------------------------------------------------------------