14

I created a shared folder using samba in ubuntu to enable windows machines can access it with the following command:

$ sudo net usershare add documents /home/developer/documents "Developer documents" everyone:F guest_ok=y

I give 777 permissions to the folder:

$ sudo chmod 0777 /home/developer/documents

And then I check what I've done

$ sudo net usershare info --long

When I want to see if the folder is visible from all windows machine, you can see. However, you cann't access that folder and get error of: "Permission Denied"

The message in: /var/log/samba/log.ip-domain is:

process_usershare_file: stat of /var/lib/samba/usershares/backuparsac failed. Permission denied

Then, I try to add some rules to my smb.conf

[documents]
   comment = Documents for Developers
   path = /home/developer/documents
   browseable = yes
   writable = yes
   read only = yes
   guest ok = yes
   directory mask = 0777

but the error of Permission denied keeps coming. Is there anything else I need to do? I need this folder can be accessed by all windows machines.

NOTE: I use Ubuntu 14.04

  • Aren't you on Ubuntu 14.04 ? I have similar problem on it and cannot make it work. Tried by installing libpam-smbpass, and cifs-utils, but nothing made the error go away – Dolanor Aug 28 '14 at 16:03
  • You have both `read only = yes` and `writable = yes` - that might also not work – MrMajestyk Apr 10 '15 at 10:07

2 Answers2

14

The cause is that Samba does not synchronize its users with the system. This solved the issue in my case, on Kubuntu 14.10:

sudo apt-get install libpam-smbpass
sudo service samba restart

If you don't want to synchronize users with PAM, simply add a user to Samba's password database:

sudo smbpasswd -a <user>

After that, the user will be able to open shared folders on the Samba machine.

Sergiu
  • 158
  • 8
  • Installing libpam-smbpass worked for me, but instead of restarting samba service or either smbd service, worked just after restarting the computer. – Scot Bernard Apr 24 '15 at 19:21
  • Rather than rebooting can use `sudo service nmbd stop` and `sudo service smbd stop`. I always stop `nmbd` as well just to make sure. Then repeat the above two commands replacing `stop` with `start`. – D-Dᴙum Jan 30 '16 at 09:08
  • Worked for me too, but I had to reboot (Linux Mint 17.3). Just restarting samba, nmbd, or smbd didn't do it. When I rebooted, I got a popup when signing back in saying "User added: " which I suspect was libpam-smbpass doing its job. – T.J. Crowder Mar 02 '16 at 10:20
  • 2
    A year after the answer, the package was removed: https://lists.samba.org/archive/samba-cvs/2015-October/111473.html – George Sovetov Jul 17 '20 at 08:25
7

Your configuration file seems to be fine.

I reckon there might be a permission issue in your parent folder.

I suggest you check /home and /home/developer both have 755 rather than 750 permission.

Then check sudo -u nobody ls /home/developer/documents.

If ls is successful, the samba is likely to work as you expected as well

lightpen
  • 478
  • 4
  • 4