Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

process_usershare_file: stat of failed. Permission denied Samba

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

like image 352
Eduardo Gabriel Cabrera Japa Avatar asked Aug 11 '14 18:08

Eduardo Gabriel Cabrera Japa


2 Answers

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.

like image 85
Sergiu Avatar answered Nov 16 '22 10:11

Sergiu


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

like image 25
lightpen Avatar answered Nov 16 '22 12:11

lightpen