Fix cifs_mount Failed Return Code -13 on Linux
The CIFS kernel return code -13 means EACCES, or permission denied: the mount failed because access was denied, most often during authentication or authorization. Start with the kernel message immediately before the final failure, then check the account, domain, credentials file, and share permissions before changing SMB versions. Use this table to identify the right troubleshooting path.
| Message or Behavior | Likely Cause | First Action |
|---|---|---|
STATUS_LOGON_FAILURE or failure during SessSetup |
Incorrect account, password, domain, or authentication policy | Test the intended SMB account against the exact share |
| Access denied during tree connection | The account cannot access the requested share | Check server-side share permissions and filesystem ACLs |
smbclient works, but the kernel mount fails |
Different credentials, mount options, or client capabilities | Try a minimal mount with a protected credentials file |
CIFS: Invalid version specified |
An invalid or unsupported SMB dialect selection | Check client and server support; remove an unnecessary version override |
A manual mount works, but /etc/fstab fails |
Different options, credentials path, or boot-time authentication context | Test the entry by mounting its configured mount point |
What the CIFS Mount Error Means
A CIFS mount makes an SMB network share available through a local Linux directory. For example, a share named //fileserver.example.com/team can appear at /mnt/team. Despite the historical “CIFS” name, current Linux clients can use modern SMB protocols.
The mount.cifs helper, supplied by cifs-utils, passes the mount configuration to the Linux kernel’s CIFS client. When the operation fails, you may see both a terminal error and a kernel-log message.
The final return code identifies an error category, not the exact cause. A rejected password, an account without share access, and an authentication-policy mismatch can all end in permission denied.
Also, local administrator privileges and remote permissions are separate. Running a mount with sudo allows the local mount operation; it does not give the SMB account additional access on the server.
How to Fix a CIFS Permission-Denied Mount
Use one server, share, account, and mount point throughout the tests. The examples use fileserver.example.com, the share team, the account alice, and the domain EXAMPLE; replace those values with your own.
Step 1: Capture the Useful Error and Check the Client Tools
- Immediately after a failed attempt, inspect the kernel log. On a systemd-based distribution:
sudo journalctl -k -b --no-pagerAlternatively:
sudo dmesgLook for the messages surrounding the attempted share mount, not just the final line. An authentication failure may look like this:
Status code returned 0xc000006d STATUS_LOGON_FAILURE CIFS VFS: cifs_mount failed w/return code = -13SessSetupidentifies session setup, where authentication occurs. A tree-connection failure happens when the client tries to connect that session to a particular share. Server logs may provide a more specific reason than the Linux log. - Confirm that the mount helper exists:
command -v mount.cifsIf it is missing, install the client tools. On Debian or Ubuntu:
sudo apt install cifs-utils smbclientOn Fedora or RHEL-family systems using DNF:
sudo dnf install cifs-utils samba-clientA missing helper is a prerequisite problem, not evidence that the server rejected your password.
Step 2: Test the Account Against the Exact Share
- Connect using
smbclient, allowing it to prompt for the password:smbclient '//fileserver.example.com/team' -U alice -W EXAMPLE -c 'ls'Use the SMB account’s password, not a Windows Hello PIN. For an Active Directory account, supply the account’s domain. For a Windows local account, the appropriate domain may be the server’s computer name. For a standalone NAS or Samba account, omit
-W EXAMPLEunless its configuration requires a domain or workgroup. - Identify where the test fails: – Session setup fails: check the identity, password, account status, and authentication policy. – Tree connection fails: check the share name and the account’s access to that share. – Connection succeeds, but listing fails: investigate directory permissions or ACLs. – Files are listed: the account can authenticate and list that share through
smbclient.
A successful SMB login does not prove that the account can access the requested share.
Testing the exact share is more useful than merely listing available shares. However, smbclient uses Samba’s userspace client, while mount.cifs uses the kernel client. Success narrows the problem; it does not prove that both clients use identical protocol and authentication settings.
Step 3: Correct and Protect the Credentials File
Use a credentials file rather than placing the password in the mount command. This avoids exposing it in shell history and avoids several parsing problems.
- Create the configuration directory if necessary:
sudo mkdir -p /etc/samba - For a new credentials file, create it with root ownership and mode
600, allowing only its owner to read and write it:sudo install -m 600 -o root -g root /dev/null /etc/samba/team.credentialsThis command empties an existing file. Do not use it to recreate a credentials file whose contents you need to preserve.
- Edit the file:
sudoedit /etc/samba/team.credentialsEnter the actual account details:
username=alice password=YOUR_ACTUAL_SMB_PASSWORD domain=EXAMPLERemove the domain line if no domain is required. Save the file as plain text with Linux line endings and no byte-order mark.
The values are literal: do not add shell quotes around the password. A credentials file handles a password containing a comma, whereas a password supplied in the comma-separated mount option string can be split incorrectly. Shell quoting alone does not solve that option-parser problem.
Separating the username and domain also avoids another common mistake: a shell can consume the backslash in an unquoted DOMAIN\alice. That is a quoting problem, not proof that domain-qualified usernames are universally unsupported.
The credentials file still contains a plaintext secret. Keep it out of source control, diagnostic attachments, and broadly accessible backups.
Step 4: Resolve Server-Side Access Denials
If the direct SMB test fails, correct the server-side problem before experimenting with mount flags.
- For a session-setup failure, have the account checked for an incorrect password, lockout, expiration, disabled status, or a restriction on network logon. Confirm that you are using the intended local or domain account, especially when both have the same username.
- For a share-access failure, verify both layers of authorization: – On Windows, check the share permissions and the underlying NTFS permissions. – On Samba or a NAS, check share-level restrictions and the backing filesystem permissions or ACLs. – Ensure the account can traverse the directories leading to the requested content. Grant only the access the account actually needs. Do not replace a specific permission correction with unrestricted access for everyone.
- Repeat the direct share test after the administrator makes the correction:
smbclient '//fileserver.example.com/team' -U alice -W EXAMPLE -c 'ls'
A successful listing confirms the account can reach the intended directory. If authentication policy requires Kerberos rather than password-based NTLM authentication, use the organization’s Kerberos configuration rather than weakening the server’s policy.
Step 5: Try a Minimal Manual Mount
- Create the local mount point:
sudo mkdir -p /mnt/teamCheck whether something is already mounted there:
findmnt --mountpoint /mnt/teamIf it shows an existing mount, do not mount another filesystem over it. Choose an unused directory or safely unmount the existing filesystem first.
- Mount with only the share path and credentials file:
sudo mount -t cifs '//fileserver.example.com/team' /mnt/team -o credentials=/etc/samba/team.credentialsOn current Linux clients, leaving
vers=unset allows negotiation of a mutually supported modern SMB dialect. Starting without extra options removes obsolete authentication overrides and unnecessary version pins from the test. - Verify that the mount exists and exposes the expected files:
findmnt --mountpoint /mnt/teamsudo ls -la /mnt/team
If the mount still fails, inspect the newly generated kernel messages. Do not assume the reason is unchanged after correcting an account or configuration issue.
Avoid adding legacy options such as sec=ntlm merely because an old tutorial recommends them. Likewise, noperm disables client-side permission checking; it cannot override the server’s authentication or access checks.
Step 6: Make the Working Mount Persistent
Only create an automatic mount after the manual test succeeds.
- Back up
/etc/fstabbefore editing it, using a backup filename that does not replace a backup you need:sudo cp -a /etc/fstab /etc/fstab.before-cifs - Edit the file:
sudoedit /etc/fstabAdd an entry using the options that worked:
//fileserver.example.com/team /mnt/team cifs credentials=/etc/samba/team.credentials,_netdev 0 0Keep the credentials path absolute.
_netdevmarks the filesystem as network-dependent, but a domain controller or authentication service may not be ready when the mount is attempted. If a share name or mount-point path contains a space, represent that space as\040in/etc/fstab; shell-style quoting is not a substitute for fstab escaping. - On a systemd-based system, reload the generated mount configuration:
sudo systemctl daemon-reload - During a safe maintenance window, close applications using the share and unmount the manual mount:
sudo umount /mnt/teamIf it is busy, stop and identify the processes using it rather than forcing the unmount.
- Mount using only the mount point so that the test actually reads
/etc/fstab:sudo mount /mnt/team - Confirm the configured mount and directory listing:
findmnt --mountpoint /mnt/teamsudo ls -la /mnt/team
This tests the specific entry without attempting every unmounted filesystem in /etc/fstab.
Special Cases That Need a Different Diagnosis
Protocol mismatches, Kerberos-only authentication, and container security restrictions require diagnosis beyond a routine permission-denied fix.
Protocol Negotiation and Legacy Servers
Modern SMB deployments commonly use dialects from SMB2.1 through SMB3.1.1. The exact usable version depends on the server’s enabled dialects and the Linux client’s supported versions, not simply on the server’s brand.
For NetApp ONTAP 9, the NetApp troubleshooting example forces vers=3.0 and fails with “Host is down,” while the kernel log includes CIFS: Invalid version specified. That is a failing configuration to investigate, not a recommendation to force that setting. Confirm the enabled dialects in the NetApp ONTAP SMB configuration and the versions supported by the Linux client.
For an old server confirmed to support only SMB1 rather than SMB2.1 or SMB3, vers=1.0 selects the legacy dialect. Confirm that limitation in the old server’s supported-dialect configuration before considering it. Prefer upgrading or replacing the legacy service; SMB1 is obsolete and should not be enabled as a routine permission-denied fix.
After correcting a dialect mismatch, test a manual mount and verify file access before saving the setting permanently.
Kerberos-Only Authentication
A server that requires Kerberos may reject an otherwise correct username and password when the client attempts NTLM authentication.
The sec=krb5 option selects Kerberos, but it does not obtain a ticket or configure the necessary client integration. A usable ticket, correct hostname and service principal, and access to the appropriate credentials are prerequisites. Running a command through sudo can also change which user’s credentials are available.
Treat this as a Kerberos configuration problem: use the approved ticket and mount setup, then verify access as the intended user. Do not relax server authentication policy just to make a password-file test pass.
Containers and Local Security Restrictions
A container that reports “Operation not permitted” without a matching CIFS authentication failure may lack mount privileges or be blocked by its security policy. That is different from a server rejecting an SMB account.
For containerized applications, mounting the share on the host and exposing only the required directory to the container is often preferable to granting broad container privileges. Also check for relevant SELinux or AppArmor denials when local access is blocked. Correct the specific policy or deployment configuration rather than disabling confinement.
How to Verify the Fix and Keep the Mount Working
A successful mount command is only the first check. Confirm that:
- The mount source is the intended server and share.
- The directory contains the expected remote files, not just an empty local directory.
- The intended local user or service can open a known readable file.
- If writing is required, that user can create, read, and delete a disposable test file without changing existing data.
- An automatic mount succeeds in the environment where it will actually run, including after a planned reboot if boot-time mounting is required.
If root can access the mounted share but an ordinary local user cannot, investigate local ownership and permission presentation as well as server ACLs. Options such as uid=, gid=, file_mode=, and dir_mode= can affect local access checks; they do not change the SMB account used to authenticate.
Keep the working configuration minimal. Remove obsolete options instead of accumulating every suggested workaround, and update the credentials file when the account password changes.
If the problem remains, collect the exact timestamp, surrounding CIFS log messages, a sanitized mount command, the direct smbclient result, and the client versions:
uname -r
mount.cifs -V
Give those details to the server administrator so they can correlate the attempt with server-side authentication and access logs. Exclude passwords, credentials-file contents, and Kerberos ticket material.
Frequently Asked Questions
Why Does a CIFS Mount Fail Twice and Then Connect Successfully?
Intermittent success usually points to changing availability or authentication context, not a requirement to retry a particular number of times. Network readiness, DNS, domain-controller availability, and ticket availability can differ between attempts. Compare timestamps in client and server logs, and avoid repeated password attempts that could lock the account.
What Does CIFS Return Code -5 Mean?
Return code -5 means EIO, an input/output error, and does not identify a single cause. Inspect the preceding CIFS messages and server logs for protocol failures, connection problems, or server-side errors. Do not assume it is another name for an incorrect password.
What Does Return Code -112 Mean on a Guest Mount?
Return code -112 means EHOSTDOWN, commonly displayed as “Host is down,” but it does not necessarily mean the server is powered off. Connection establishment or SMB dialect negotiation can fail even when the machine is reachable. Guest access changes authentication behavior; it does not resolve an unsupported protocol or blocked connection.
What Does CIFS Return Code -126 Mean?
Return code -126 means ENOKEY, or “Required key not available.” With Kerberos-based mounts, check ticket availability, credential selection, and the client’s CIFS upcall and key-handling configuration. This is a key-availability problem, not automatically a wrong-password problem.
What Does “Mount Error 115: Operation Now in Progress” Mean?
Error 115 is EINPROGRESS; the message alone does not identify why the SMB mount failed to complete. Check the surrounding kernel log, name resolution, server reachability, and access to TCP port 445 for direct SMB connections. Investigate connection setup before changing passwords or filesystem permissions.
