process_usershare_file: stat of failed. Permission denied Samba

Eduardo Gabriel Cabrera Japa picture Eduardo Gabriel Cabrera Japa · Aug 11, 2014 · Viewed 23.2k times · Source

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

Answer

Sergiu picture Sergiu · Oct 7, 2014

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.