NT_STATUS_ACCESS_DENIED and mount error(13): Permission denied

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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


<think>嗯,用户遇到了构建目录结构时权限不足的问题,具体错误是“build_directory_structure lstat Permission denied”。我需要先分析可能的原因,然后提供解决方案。首先,权限问题通常涉及文件或目录的所有权及访问权限。用户可能尝试访问的目录没有执行权限,或者父目录没有足够的权限,导致无法遍历。此外,SELinux的安全上下文也可能阻止访问,尤其是在使用强制模式的情况下。 接下来,我应该分步骤指导用户检查权限。第一步是使用ls -l命令查看相关目录的权限,确认用户是否有读、写、执行权限。如果没有,可能需要用chmod修改权限或用chown更改所有者。然后,检查父目录的权限,因为即使目标目录权限正确,父目录缺少执行权限也会导致问题。 另外,SELinux可能是一个因素。用户需要检查SELinux的状态,如果是enforcing模式,可以尝试暂时设置为permissive,看问题是否解决。如果是SELinux的问题,需要恢复上下文或添加策略模块。最后,应用程序本身可能需要特定权限,比如以sudo运行或配置CAP_DAC_OVERRIDE能力。 还要考虑用户是否在正确的路径下操作,避免拼写错误。同时,生成相关问题可以帮助用户深入理解权限管理和SELinux配置,比如如何递归修改权限、SELinux模式切换方法等。确保回答结构清晰,步骤明确,引用相关的文档,比如Fedora的SELinux指南。</think>### 解决"build_directory_structure lstat Permission denied"权限问题 #### 1. 验证目录所有权 使用命令检查目录所有者: ```bash ls -ld /path/to/directory ``` - 若用户无权限,执行: ```bash sudo chown -R $USER:$USER /path/to/directory ``` - 若需要保留原所有者但开放访问权限: ```bash sudo chmod -R 755 /path/to/directory ``` #### 2. 检查父目录权限 路径中所有父目录至少需要`execute`权限才能遍历: ```bash ls -l /path/to/parent/directories ``` 补充缺失权限: ```bash sudo chmod +x /path/to/parent ``` #### 3. SELinux上下文验证(重要) 当基础权限正常仍报错时,需检查SELinux安全上下文: ```bash ls -Z /path/to/directory ``` 临时解决方案(测试用): ```bash sudo setenforce 0 ``` 永久解决方案: ```bash sudo semanage fcontext -a -t httpd_sys_content_t "/path/to/directory(/.*)?" sudo restorecon -Rv /path/to/directory ``` #### 4. 应用程序特殊权限 对于需要突破DAC限制的程序: ```bash sudo setcap cap_dac_override+ep /path/to/executable ``` #### 5. 路径有效性验证 确保路径不存在拼写错误或隐藏字符: ```bash echo "/path/to/directory" | hexdump -C ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值