How to Fix “mount error(13): Permission denied” When Mounting Windows Share on CentOS 6.4


2 views

The error occurs when trying to mount a Windows Server 2008 share on CentOS 6.4 using CIFS, despite successful authentication via smbclient. The key symptoms are:

  • Works with smbclient: smbclient //esb.local/dfs -U ESBSertal -W ESB -P MyPassword
  • Fails with mount.cifs: Permission denied (error 13)
  • Fails both in command line and /etc/fstab configurations

1. Credentials Format:
Try alternative credential formats:

mount -t cifs //esb.local/dfs /mnt/win -o username=ESBSertal,password=MyPassword,domain=ESB,sec=ntlm

2. Security Mode:
The Windows server might require specific security modes:

mount -t cifs //esb.local/dfs /mnt/win -o username=ESBSertal,password=MyPassword,domain=ESB,sec=ntlmv2

3. File Permissions:
Ensure proper permissions on the mount point:

chmod 755 /mnt/win
chown root:root /mnt/win

Enable verbose logging for deeper diagnostics:

mount -t cifs //esb.local/dfs /mnt/win -o username=ESBSertal,password=MyPassword,domain=ESB,debug=1

Check kernel messages for additional clues:

dmesg | tail -20

Using credentials file:
Create /etc/samba/credentials:

username=ESBSertal
password=MyPassword
domain=ESB

Then mount with:

mount -t cifs //esb.local/dfs /mnt/win -o credentials=/etc/samba/credentials

Persistent fstab entry:
For reliable automount, consider:

//esb.local/dfs /mnt/win cifs credentials=/etc/samba/credentials,uid=1000,gid=1000,file_mode=0644,dir_mode=0755 0 0

When attempting to mount a Windows Server 2008 share on CentOS 6.4 (64-bit) using mount.cifs, users frequently encounter the frustrating "Permission denied" error despite successful authentication via smbclient. This discrepancy indicates deeper permission or configuration issues beyond basic credential validation.

Before diving into solutions, let's verify these critical components:

# Verify SMB client functionality
smbclient -L //esb.local -U ESBSertal%MyPassword -W ESB

# Check mount point permissions
ls -ld /mnt/win
chmod 755 /mnt/win  # If needed

The basic mount command should include these critical parameters:

mount.cifs //esb.local/dfs /mnt/win -o \
username=ESBSertal,password=MyPassword,domain=ESB,\
uid=$(id -u),gid=$(id -g),file_mode=0644,dir_mode=0755,\
vers=2.1,sec=ntlmssp

1. SMB Protocol Version Negotiation

Modern Windows servers often require explicit protocol specification:

# Try different SMB versions
mount.cifs ... vers=3.0
mount.cifs ... vers=2.1
mount.cifs ... vers=1.0

2. Security Mode Specification

Different authentication security modes may be needed:

mount.cifs ... sec=ntlmv2
mount.cifs ... sec=ntlmssp
mount.cifs ... sec=krb5

For persistent mounts, use this /etc/fstab entry format:

//esb.local/dfs  /mnt/win  cifs  credentials=/etc/smbcredentials,uid=1000,gid=1000,file_mode=0644,dir_mode=0755,vers=2.1  0  0

Create a secure credentials file:

# /etc/smbcredentials
username=ESBSertal
password=MyPassword
domain=ESB

Enable verbose logging to identify the exact failure point:

mount.cifs ... -o debug
dmesg | tail -20  # Check kernel messages
journalctl -xe    # Systemd journal inspection

On the Windows server, verify these settings:

  • Share permissions (Security tab)
  • NTFS permissions
  • SMB1 protocol status (often needs disabling)
  • Network access policies

When direct mounting fails, consider these workarounds:

# Use autofs for on-demand mounting
automount -t cifs //esb.local/dfs /mnt/win -o credentials=/etc/smbcredentials

# Or use sshfs as alternative
yum install fuse-sshfs
sshfs user@esb.local:/dfs /mnt/win