Ubuntu – File sharing through samba is not working over LAN

file-sharingsamba

I am getting the following error while running net usershare command.

'net usershare' returned error 255: net usershare: cannot open usershare directory /var/lib/samba/usershares. Error Permission denied
You do not have permission to create a usershare. Ask your administrator to grant you permissions to create a share.

How to fix this?
Thanks,
🙂

Best Answer

The directory /var/lib/samba/usershares is set up so only root or members of the sambashare group can read or write to it.

drwxrwx--T  2 root sambashare  4096 Mar 25  2012 usershares

That you can't access it (try it by cding to it) suggests to me that you're not in the sambashare group. You can test this with id $USER and assuming usershares is not in the output, you can fix all this just by running:

sudo usermod -a -G sambashare $USER

If you still get error 255 after adding the particular user to the group you might need to reboot.

Related Question