Software & AppsOperating SystemLinux

Ubuntu Local Network Share: Fixing “Failed to mount Windows share: Permission denied” Error

Ubuntu 14

In this article, we will delve into the issue of the “Failed to mount Windows share: Permission denied” error that you may encounter while trying to access a shared directory on a home server running Ubuntu 19.04. We’ll cover the common causes and provide step-by-step solutions to rectify this problem.

Quick Answer

To fix the "Failed to mount Windows share: Permission denied" error on Ubuntu, you can try two solutions. First, set up a Samba password for the user by using the sudo smbpasswd -a <username> command. Second, adjust the permissions on the parent folders using the sudo chmod o+rx /dir1 command. If these solutions don’t work, you can troubleshoot further by using the net usershare info --long command and referring to additional resources.

Understanding the Error

The error message “Failed to mount Windows share: Permission denied” typically arises due to two main reasons:

  1. Incorrect or Missing Samba Password: When asked for “registered user” credentials, you may have entered the wrong password or not entered a password at all.
  2. Restricted Path to Shared Directory: Even if the shared folder allows guest access, the path leading to that folder may not. If the path to the folder is restricted, it will prevent access to the shared folder.

Solution 1: Setting Up Samba Password

The first solution involves creating a samba password for the user by adding them to the samba password database. This can be achieved using the following command:

sudo smbpasswd -a <username>

In the above command, replace <username> with the actual username. The sudo command is used to run the command as a superuser, smbpasswd is the command to set the Samba password, -a is the option to add a new user, and <username> is the name of the user you want to add.

Solution 2: Adjusting Permissions

The second solution involves adjusting the permissions on the parent folders. This is necessary when the path to the shared folder does not allow access. For example, if the shared directory is /dir1/shared_dir, you can grant read access to all users by running the following command:

sudo chmod o+rx /dir1

In this command, sudo is used to run the command as a superuser, chmod is the command to change file mode bits, o+rx is the option to give others (o) read (r) and execute (x) permissions, and /dir1 is the directory on which the permissions are being changed.

Additional Troubleshooting Steps

If the above solutions do not resolve the issue, you can use the following command to determine the correct path to the shared folder:

net usershare info --long

This command displays detailed information about all shared resources on the network.

To allow all users to access the shared folder, you may need to adjust the permissions or use other settings in Samba, such as “force user”.

For more detailed troubleshooting steps, you can refer to this Linux Mint Forum post.


In this article, we’ve covered the common causes of the “Failed to mount Windows share: Permission denied” error and provided detailed solutions. Remember, it’s important to ensure that the user has the necessary permissions to traverse the parent folders to reach the shared folder. This can be achieved by adjusting the permissions or using other settings in Samba. If you’re still experiencing issues, don’t hesitate to seek help from the Ubuntu community or professional IT support.

How do I know if I have entered the correct Samba password?

To verify if you have entered the correct Samba password, you can try logging in to the shared directory using the same username and password combination. If you are able to access the directory successfully, then the password is correct.

Can I set the Samba password for multiple users at once?

No, you need to set the Samba password for each user individually using the sudo smbpasswd -a <username> command mentioned in Solution 1.

Leave a Comment

Your email address will not be published. Required fields are marked *