NT_STATUS_ACCESS_DENIED and mount error(13): Permission denied

本文介绍了如何通过修改Windows 10注册表设置来解决从RHEL 6.3使用smbclient命令访问隐藏共享文件夹时遇到的权限拒绝问题。文章详细记录了错误现象、尝试过的解决方案以及最终成功的步骤。

Summary

I was trying to use smbclient to display and access Windows 10 hidden shared folder from RHEL6.3, smbclient command encountered tree connect failed: NT_STATUS_ACCESS_DENIED error, when mount through cifs, encountered mount error(13): Permission denied error. Finally resolved this issue through changing the Windows 10 regedit table.

Problem

smbclient display

When smbclient display, no issue,

[root@node1 ~]# smbclient -L //192.168.232.1 -U xionghuilin
Enter xionghuilin's password:
session request to 192.168.232.1 failed (Called name not present)
Domain=[LENOVO-XHL-PC] OS=[Windows 10 Pro 14393] Server=[Windows 10 Pro 6.3]

    Sharename       Type      Comment
    ---------       ----      -------
    ADMIN$          Disk      Remote Admin
    C$              Disk      Default share
    D$              Disk      Default share
    IPC$            IPC       Remote IPC
    print$          Disk      Printer Drivers
    Users           Disk
session request to 192.168.232.1 failed (Called name not present)
session request to 192 failed (Called name not present)
session request to *SMBSERVER failed (Called name not present)
NetBIOS over TCP disabled -- no workgroup available
[root@node1 ~]#

Error access by smbclient

[root@node1 ~]# smbclient //192.168.232.1/C$ -U xionghuilin
Enter xionghuilin's password:
Domain=[LENOVO-XHL-PC] OS=[Windows 10 Pro 14393] Server=[Windows 10 Pro 6.3]
tree connect failed: NT_STATUS_ACCESS_DENIED
[root@node1 ~]#

Error to mount by cifs

change password to 123456

C:\WINDOWS\system32>net user xionghuilin 123456
The command completed successfully.

mount error(13): Permission denied

[root@node1 ~]# mount -t cifs -o user=xionghuilin%123456 //192.168.232.1/ADMIN$ /smb
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

Solution

change the Windows 10 regedit table

Through google, resolved this issue by change the regedit table, refer to Link1 and Link2.
Create new regedit table entry,
Key goes in:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\Policies\System
Key DWORD (32-bit): LocalAccountTokenFilterPolicy
Key Value : 1
As below screenshot shows,
change the regedit table

result

smbclient

[root@www ~]# smbclient //192.168.232.1/ADMIN$ -U xionghuilin%123456
Domain=[LENOVO-XHL-PC] OS=[Windows 10 Pro 14393] Server=[Windows 10 Pro 6.3]
smb: \> dir
cli_list_new: Error: unable to parse name from info level 260
  .                                  DA        0  Wed Jan 11 19:32:51 2017
  ..                                 DA        0  Wed Jan 11 19:32:51 2017
  addins                              D        0  Sat Jul 16 19:47:50 2016
cli_list_new: unable to parse name from info level 260

        49999 blocks of size 2097152. 5947 blocks available
[root@www ~]# mount -t cifs -o user=WORKGROUP/xionghuilin%123456,sec=ntlmv1 //192.168.232.1/ADMIN$ /smb --verbose
mount.cifs kernel mount options: ip=192.168.232.1,unc=\\192.168.232.1\ADMIN$,sec=ntlmv1,ver=1,user=xionghuilin,domain=WORKGROUP,pass=********
[root@www ~]# ls /smb
addins                            Globalization          PolicyDefinitions       SSW0E58417.SSW0F96302
appcompat                         Help                   Prefetch                symbols
AppPatch                          HelpPane.exe           PrintDialog             Synaptics.log
AppReadiness                      hh.exe                 Professional.xml        Synaptics.PD.log
assembly                          IME                    Provisioning            SYSINFO.TXT
bcastdvr                          ImmersiveControlPanel  regedit.exe             System
bfsvc.exe                         INF                    Registration            System32
BitLockerDiscoveryVolumeContents  InfusedApps            RemotePackages          SystemApps
Boot                              InputMethod            rescache                system.ini
bootstat.dat                      Installer              Resources               SystemResources
Branding                          L2Schemas              RtCamU64.exe            SysWOW64
CbsTemp                           LiveKernelReports      RtlExUpd.dll            TAPI
comsetup.log                      Logs                   RtsCM64.exe             Tasks
CoreSingleLanguage.xml            Media                  RtsCM64.xml             Temp
CSC                               MediaViewer            SchCache                ToastData
CSUP.TXT                          MEMORY.DMP             schemas                 tracing
Cursors                           MFGSTAT.zip            S.dirmngr               twain_32
debug                             mib.bin                security                twain_32.dll
diagerr.xml                       Microsoft.NET          ServiceProfiles         vpnplugins
diagnostics                       Migration              servicing               Vss
diagwrn.xml                       MiracastView           Setup                   Web
DigitalLocker                     ModemLogs              setupact.log            WIN8_1_64
Downloaded Installations          notepad.exe            setuperr.log            WindowsShell.Manifest
Downloaded Program Files          OCR                    ShellExperiences        WindowsUpdate.log
DPINST.LOG                        ODBC.INI               ShellNew                winhlp32.exe
DtcInstall.log                    Offline Web Pages      SKB                     win.ini
ELAMBKUP                          Panther                SoftwareDistribution    WinSxS
en-GB                             PCHEALTH               Speech                  WMSysPr9.prx
en-US                             pear.ini               Speech_OneCore          write.exe
explorer.exe                      Performance            splwow64.exe            zh-CN
Fonts                             PFRO.log               SQL9_KB960089_ENU
GameBarPresenceWriter             PLA                    SQLTools9_KB960089_ENU
[root@www ~]#

Reference

1,Unable to mount windows share in ubuntu
2, Issue Mounting CIFS Share


`tree connect failed: NT_STATUS_ACCESS_DENIED` 错误通常表示在尝试连接到 Samba 共享时,由于权限问题或配置错误而被拒绝访问。以下是一些可能的解决方法: ### 检查用户名和密码 确保使用的用户名和密码是正确的,并且该用户在 Samba 服务器上有访问共享的权限。可以使用 `smbclient` 命令手动测试连接: ```bash smbclient //server_name/share_name -U username%password ``` 其中 `server_name` 是 Samba 服务器的名称或 IP 地址,`share_name` 是共享的名称,`username` 和 `password` 是用于访问共享的用户名和密码。 ### 检查 Samba 配置文件 确认 Samba 配置文件(通常是 `/etc/samba/smb.conf`)中共享的权限设置正确。确保共享的 `valid users`、`read list` 和 `write list` 选项允许当前用户访问。例如: ```plaintext [share_name] path = /path/to/share valid users = username read only = no ``` ### 检查文件系统权限 确保共享目录及其父目录的文件系统权限允许 Samba 服务器访问。可以使用 `chmod` 和 `chown` 命令来调整权限。例如: ```bash chmod -R 775 /path/to/share chown -R nobody:nobody /path/to/share ``` ### 检查防火墙设置 确保防火墙允许 Samba 服务的流量通过。Samba 使用 TCP 端口 139 和 445 进行通信。可以使用以下命令开放这些端口: ```bash sudo firewall-cmd --permanent --add-service=samba sudo firewall-cmd --reload ``` ### 重启 Samba 服务 在进行了上述更改后,重启 Samba 服务使更改生效: ```bash sudo systemctl restart smb nmb ``` ### 检查 SELinux 或 AppArmor 如果系统启用了 SELinux 或 AppArmor,可能需要调整其策略以允许 Samba 访问共享目录。可以临时禁用 SELinux 进行测试: ```bash sudo setenforce 0 ``` 如果禁用 SELinux 后问题解决,需要配置 SELinux 策略以允许 Samba 访问。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值