0

I'm trying to set up a shared folder so that only a specific user (steve) can access. Steve is the only user on my machine and the share is set up using Steve's account.

The share is set up like

enter image description here

On my local Ubuntu Desktop 21.04 machine, when I navigate to Other Locations, double click on my local machine's name under Networks, and double click the Test folder, it says Authentication Required.

I click Registered User, type Steve's password in, and it just re-opens the Authentication Required required window as if I wasn't authenticated.

ls -la says the permissions for the folder are:

drwxrwxrwx  1 steve    steve     0 Aug 28 19:02  Test

Have I missed something when setting up the folder share?


Not sure if it makes any difference, but Test is on an external HDD. Also, I presume it uses Samba but I'm not sure.

When trying to access the shared network folder using a Windows machine, I also get the authentication window. I type in Steve's details, and it says authentication failed.

Dan
  • 145
  • What do you mean by "I'm trying to access a shared folder on my machine using my machine"? Are you trying to access the shared folder from the same machine as a different user? Are you trying from the same (dual boot) machine after booting Windows? Or do you have two machines, and both are called "my machine"? See this answer for some information on using shared folder. – user68186 Aug 28 '21 at 18:44
  • If you want to share a folder between two local users, say Dan and Doll, in a single Ubuntu computer, then see this answer. – user68186 Aug 28 '21 at 18:48
  • @user68186 Sorry for miscommunication. I'm trying to access the network share folder on the machine that has shared the folder. However, I'm accessing it through the Networks section rather than accessing it directly. Also, I'm not trying to share it between different users, just want to access it with my own account, but it seems to be denying it. Thanks for the links, will have a look now – Dan Aug 28 '21 at 18:59
  • 1
    Please [edit] your post to add new information, properly formatted. Information added via comments is hard for you to format, hard for us to read and ignored by future readers. Please click [edit] and add that vital information to your question so all the facts we need are in the question. Please don't use Add Comment, since that's our uplink to you. All facts about your system should go in the Question with [edit] – waltinator Aug 28 '21 at 19:38
  • @waltinator The question has been updated to hopefully rule out any confusion. Please let me know if it requires any more information – Dan Aug 28 '21 at 19:53

1 Answers1

2

Turns out there was quite a lot I hadn't done. It wasn't as simple as installing Samba and setting up the folder share by right clicking on it.

I also had to:

  1. Create a samba user account for Steve: sudo smbpasswd -a steve

  2. Configure the smb.conf to set the security mode to user. Ran sudo gedit /etc/samba/smb.conf and added security = user under workgroup = WORKGROUP under the [global] section.

  3. Added a section to the smb.conf defining the information about the folder I wanted to share.

    [Test]
        path = "/media/steve/external drive/Test"
        read only = no
        writeable = yes
        browseable = yes
        valid users = steve
        create mask = 0777
        directory mask = 0777
    
  4. Restarted the smb service by running sudo service smbd restart

I can now access the shared folder both locally through the Networks section and on other machines.


For each folder you want to share, you need to define a section like the 3rd point shows and then restart the service like the 4th point shows

Dan
  • 145
  • You might want to remove the share you created in Nautilus since it is different than the one you created in smb.conf. The nautilus share allows anyone with a samba password access to the share not just the one. You can remove the share through nautilus or by deleting the "test" file under /var/lib/samba/usershares. – Morbius1 Aug 29 '21 at 11:05
  • @Morbius1 Is that the GUI bit I showed in the question? – Dan Aug 29 '21 at 11:57
  • Yes. It uses a package called nautilus-share that creates a samba usershare at /var/lib/samba/usershares. It's different from the "classic" samba shares created in smb.conf. Samba can get confused if you share the same folder using both methods. – Morbius1 Aug 29 '21 at 17:27