Cannot access shared folder in ubuntu from windows 10

14,797

The way to share folders for other operating systems is a bit different and it needs a little bit of work. Let's go.

  1. sudo apt-get install samba system-config-samba
  2. Create the folder to be shared somewhere outside the /home folder as root.
    For example: sudo mkdir /Public
  3. sudo chmod -R 0777 /Public to make it fully accessible by everyone.
  4. sudo adduser --no-create-home <network_user_name> to create a new user whose name will be used to access the shared folder from the network. Since this user is going to be a network user only, no home folder is needed for them.
  5. sudo usermod -u 998 <network_user_name> to change the new user ID to anything below 1000 so that the name is not included in the lightdm logon list.
  6. sudo smbpasswd -a <network_user_name> to add the new user to the samba user list so that access can be granted when this user attempts to connect from another system.
    Note: This password has nothing to do with the user password you created when you created the user with the adduser command and it doesn't have to be the same. The other password will never be used. This is the password you will be using to access the system from the network.
  7. Run samba from its icon and enter your admin password.
    On the first tab, browse to the /Public folder and select it in order to share it. Make it Visible and Writable if you wish to have write access to it from the network.
    On the second tab make sure to check the network_user_name you'll see so that only that user is granted access to that share and not everyone.
  8. As root, use a text editor and edit /etc/samba/smb.conf. At the end of that file you will see the details about the folder you just shared. Press Enter and Tab and add the parameter inherit permissions = yes at the very end of that shared folder section. This will make sure that every new file or folder created by the network user in that share will inherit the /Public folder's permissions and it'll be fully accessible by all other users.
  9. Finally execute sudo service smbd restart && sudo service nmbd restart to restart both services with the new parameter and you should be ready to use that share from any operating system including Windows.
Share:
14,797

Related videos on Youtube

u123
Author by

u123

Updated on September 18, 2022

Comments

  • u123
    u123 over 1 year

    I have two PCs on my internal LAN. One is running windows 10 and the other is running Ubuntu 16.04. I am trying to share a folder in Ubuntu so that I can access it from windows 10. I have done:

    enter image description here

    And the clicked "Create Share" which completed without any errors. I also see the shared folder in windows but I need to provide user/password to access it. When I do that, using the same user/password I use to login to Ubuntu, I just get access denied:

    enter image description here

    Why can't I access that folder using my Ubuntu user credentials?

    • Panther
      Panther over 7 years
      my guess is you are not using the same user name on ubuntu and windows. . Check the first box or use the same user names.
    • u123
      u123 over 7 years
      No I don't use the same user name for the Windows PC and the Ubuntu PC and I don't plan to change that, is that a requirement to access a shared folder?
  • Thierry J.
    Thierry J. over 5 years
    Did not work for me, still getting "Unauthorized" error...