You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

RHEL 7.6挂载Windows CIFS共享目录遇mount error(13): Permission denied问题的排查与配置咨询

RHEL 7.6挂载Windows CIFS共享目录遇mount error(13): Permission denied问题的排查与配置咨询

Hey there, let's work through this permission denied error step by step— I’ve debugged tons of CIFS mount issues on RHEL, so let’s break this down into actionable checks.

First: Verify the Windows Side (Most Common Root Cause)

The "permission denied" error usually starts with Windows permissions or account validity, so let’s rule that out first:

  • Test the account directly on Windows: Log into the Windows server with the papa account (or switch users), then try accessing \\localhost\max_stage. If you can’t browse or modify files here, the problem is definitely with the account’s permissions on the share.
  • Don’t forget dual permissions: Windows uses both share permissions and NTFS folder permissions. Make sure papa has at least Read access in the share’s permissions, and matching NTFS permissions on the actual max_stage folder (right-click the folder → Properties → Security tab). It’s easy to set one and forget the other!
  • Check if it’s a domain account: If papa is a domain user, you need to specify the domain in your mount command, like username=YOUR_DOMAIN\papa— Windows won’t recognize the account without it otherwise.
  • Use net use for precise testing: Open Command Prompt on Windows and run:
    net use Z: \\localhost\max_stage /user:papa japeto
    
    Replace Z: with an unused drive letter. If this fails, it’ll give you a specific error code/message (e.g., wrong password, account locked, permission missing) that points directly to the issue. If it works, the account and share are good to go.

Next: Troubleshoot the Linux Side

If Windows checks out, let’s fix potential issues on your RHEL 7.6 server:

  • Fix your mount command syntax: You’ve got two separate -o flags— while this sometimes works, it’s better to combine all options into one to avoid parsing issues. Use this instead:
    mount -t cifs -v //98.12.23.34/max_stage /mnt/target -o vers=2.0,username=papa,pass='japeto'
    
  • Check the target directory: Ensure /mnt/target is empty, and has proper Linux permissions (run chmod 755 /mnt/target if needed). This rarely causes permission denied, but it’s a quick check.
  • Test different SMB versions: Windows servers often have different SMB versions enabled. Try switching to vers=3.0 (more modern) or vers=1.0 (not secure, but useful for testing):
    mount -t cifs -v //98.12.23.34/max_stage /mnt/target -o vers=3.0,username=papa,pass='japeto'
    
  • Rule out SELinux interference: RHEL’s SELinux can block CIFS mounts by default. Temporarily disable it to test:
    setenforce 0
    
    If the mount works after this, you’ll need to set a permanent SELinux rule. Run this to allow CIFS access:
    setsebool -P samba_export_all_rw 1
    # Or set the correct context for the target directory
    chcon -t samba_share_t /mnt/target
    
  • Check firewall settings:
    • On RHEL: Make sure outbound traffic on port 445 (SMB) is allowed. Temporarily stop firewalld to test:
      systemctl stop firewalld
      
      If it works, add a permanent rule:
      firewall-cmd --add-port=445/tcp --permanent
      firewall-cmd --reload
      
    • On Windows: Ensure the "File and Printer Sharing (SMB)" inbound rule is enabled in Windows Firewall.
  • Avoid password escape issues: If your password has special characters (like $, !, or @), using a credentials file is safer than passing it on the command line. Create a file (e.g., /root/cifs_creds) with:
    username=papa
    password=japeto
    
    Then set strict permissions on it:
    chmod 600 /root/cifs_creds
    
    And mount with:
    mount -t cifs -v //98.12.23.34/max_stage /mnt/target -o vers=2.0,credentials=/root/cifs_creds
    

Quick Network Check

Before wrapping up, confirm the Windows server is reachable from RHEL:

  • Ping the IP: ping 98.12.23.34
  • Test the SMB port: telnet 98.12.23.34 445 (if this fails, the network or firewall is blocking access)

Start with the Windows-side checks first— that’s where 90% of these issues live. Let me know if any of these steps resolve your problem!

备注:内容来源于stack exchange,提问作者King David

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.21 13:55:35