Ad Space — Top Banner

Samba Share Error

Linux Linux

Severity: Minor

What Does This Error Mean?

Samba allows Linux to access Windows shared folders (and vice versa) over a network. When it fails, you usually see errors like 'mount error(13): Permission denied', 'NT_STATUS_ACCESS_DENIED', or 'No route to host'. The fix depends on the exact error: wrong credentials, SMB protocol version mismatch, or firewall blocking are the three most common causes. Reading the exact error message tells you which direction to troubleshoot.

Affected Models

  • Ubuntu
  • Debian
  • Fedora
  • Arch Linux
  • Linux Mint
  • CentOS
  • openSUSE

Common Causes

  • Incorrect username or password for the Windows or Samba share
  • SMB protocol version mismatch — newer Linux kernels disabled older SMB1 which some older devices require
  • Firewall on the Windows machine or network device blocking port 445 (SMB)
  • The Samba packages (samba-client, cifs-utils) are not installed on the Linux machine
  • The Windows network sharing settings do not allow the Linux machine's IP address or user account

How to Fix It

  1. Install the required packages if not already installed. On Ubuntu/Debian: sudo apt install samba-client cifs-utils — On Fedora: sudo dnf install samba-client cifs-utils — On Arch: sudo pacman -S smbclient cifs-utils.

    cifs-utils is required for mounting SMB shares. samba-client provides the smbclient command-line tool for testing connections.

  2. Test the connection first before mounting. Run: smbclient -L //[Windows-IP-or-hostname] -U [username] — enter the password when prompted. If you see a list of shares, the connection works and the issue is with mounting parameters. If you see an error, note the exact error code.

    Error NT_STATUS_ACCESS_DENIED means wrong credentials. NT_STATUS_CONNECTION_REFUSED means firewall or SMB not enabled. NT_STATUS_PROTOCOL_NOT_SUPPORTED means SMB version mismatch.

  3. Mount the share manually with all options specified. Run: sudo mount -t cifs //[IP]/[ShareName] /mnt/point -o username=[user],password=[pass],vers=3.0 — If vers=3.0 fails, try vers=2.0 or vers=1.0 (only use 1.0 for old NAS devices as it is less secure).

    Always specify the SMB version explicitly. Letting the system auto-negotiate can sometimes result in a mismatch error even when the connection should work.

  4. On the Windows side, ensure File and Printer Sharing is enabled. Go to Control Panel > Network and Sharing Center > Advanced sharing settings. Turn on 'File and printer sharing' and 'Network discovery' for the appropriate profile.

    Also check Windows Firewall: search for 'Allow an app through Windows Firewall' and ensure 'File and Printer Sharing' is allowed on Private networks.

  5. For persistent mounts, add an entry to /etc/fstab. Edit the file as root: sudo nano /etc/fstab — and add a line: //[IP]/[ShareName] /mnt/point cifs credentials=/home/user/.smbcredentials,vers=3.0,uid=1000,gid=1000 0 0 — Create the .smbcredentials file with: username=user and password=pass on separate lines.

    Never put plain-text passwords in /etc/fstab directly. Use a credentials file and restrict its permissions with: chmod 600 ~/.smbcredentials

When to Call a Professional

Complex Samba configurations with Active Directory, Kerberos authentication, or multi-subnet routing require advanced Linux/Windows networking expertise. For home and small office use, the steps below resolve the majority of connection issues.

Frequently Asked Questions

What is the difference between Samba and NFS?

Both are network file sharing protocols, but they are designed for different environments. Samba implements the SMB protocol, which is native to Windows. It is the right choice when sharing files between Linux and Windows, or accessing Windows shared folders from Linux. NFS (Network File System) is the native Linux/Unix sharing protocol and is simpler to set up between Linux machines, but it is not natively supported by Windows. For mixed networks with Windows and Linux machines, Samba is the standard choice.

SMB1 is disabled in my Linux kernel. How do I access an old NAS?

SMB1 (also called CIFS or SMB v1.0) was disabled in many Linux kernels and distributions because it has serious security vulnerabilities (the same ones exploited by the WannaCry ransomware). To temporarily allow SMB1 for mounting an old device: add vers=1.0 to your mount options. However, the long-term fix is to update your NAS firmware — most manufacturers released SMB2 or SMB3 updates even for older hardware. Check your NAS manufacturer's support page for firmware updates.

My Linux machine can see the share but only has read access. I need write access. How?

Write access issues are usually a permissions problem on the Windows or Samba side, not the Linux side. On a Windows share, right-click the shared folder > Properties > Sharing tab > Advanced Sharing > Permissions, and grant the Change or Full Control permission to the user account you are connecting with. Also check the NTFS Security tab — the share permissions and the NTFS permissions both must allow write access. On the Linux mount, also add the uid and gid options to match your Linux user's user ID and group ID (find them with: id).