Fix Samba error 255 (Folder Sharing)

First of all, what is Samba error 255? Well, it is the error that we get when in Ubuntu (for example), we try to share a folder and we cannot because it tells us:

The "network share" 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.

This happened to me when I tried to create a shared folder on one of my users' PCs, so that I could comfortably exchange files with a Windows XP virtual machine running on Virtualbox.

In the case of Ubuntu the solution is simple, because I solved everything by executing in the terminal:

sudo chmod 777 /var/lib/samba/usershares

But this may not be the solution for others. For example, in the case of Debian it can be easily solved also by adding our user to the sambashare group.

# addgroup usuario sambashare

They just told me by MP that another possible solution is adding to the file /etc/samba/smb.conf the parameter: users share owner only = False

But let's say we want something more. In this case we do not want it to ask us for a username and password to access the shared folder. Well, for this, what we do is create a folder in / media:

# mkdir /media/compartir
# chmod -R 777

And then we add to the end of the file /etc/samba/smb.conf:

[documents] comment = Shared documents path = / media / share public = yes writable = yes

And well, in some cases we have to restart Samba:

# /etc/init.d/samba restart

Now, from the virtual machine I just have to put in Windows Explorer:

\\192.168.X.X\compartir

And ready..


10 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   arching said

    The second method is the correct one. In Ubuntu there must be a group also for that, most likely that directory does not belong to the sambashare group or something is missing in the smb.conf.
    The 777 permissions issue generates a security problem, it is better to use it occasionally to verify that it works, but, once verified, proceed to adjust the groups and / or samba configuration file.

    1.    elav said

      You're right about 777, but the idea is that "Everyone" has access to that folder to write / delete / copy / move 😉

  2.   Federico Antonio Valdes Toujague said

    greetings Elav !!!. That solution is for sharing on a home network or requiring no security. It is very similar to when in Windows XP, without having the computer registered in a Domain, we say that File Sharing is enabled and we say that Anyone can write or read in the shared resources. Therefore, there is no security.
    Anyway, in the Samba series I am obliged to dedicate one or more articles to share folders and printers. From a home network to a file server with all the laws.
    I ask for your patience in this regard, as explaining Samba is not easy. 🙂

    1.    eliotime3000 said

      In fact, Samba is much more useful to me since I use shared folders and I prefer to avoid problems with the configuration to share folders.

  3.   cat said

    thanks, this article will come in handy for the error that Samba gives me when trying to share the Public: D folder.

  4.   Federico Antonio Valdes Toujague said

    Every time I try to post a comment on Samba: SmbClient gives me the following error:

    Zone 404 you have not found what you were looking for!

    Possibly you followed an incorrect link or are looking for a document that has changed address. Return to the home page or use the search engine above to find a new destination. Or you can access other links of interest to find what you are looking for, for example:

  5.   Ricardo said

    Hello, I applied permissions chmod -R 777 to the shared directory and now it does not let me enter, it shows me the folder from Windows but when I want to enter it tells me permission denied, how is this solved?

    1.    adrian aaae said

      Give it the same but in reverse chmod -R 777 (less is to remove permissions)
      chmod + R 777 to the directory to set permissions

  6.   JORGE FRANCISCO JUAREZ ZUNIGA said

    Good afternoon everyone, I need your help:
    I am trying to connect two PCs in a network with Ubuntu and after many attempts I have been able to install samba and it appears in the launcher and after configuring a new workgroup on both PCs and sharing a folder it sends me this error (I must clarify that I did it ok once, but when restarting the pcs I don't respect the shared folder and wanting to re-share it tells me this) «The samba test parameter returned error 1: Load smb config files from /etc/samba/smb.conf
    rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
    warning: Ignoring invalid value 'share' for parameter 'security' rror loading services

  7.   CHRISTIAN ORTIZ said

    yes that way it served me on the NVIDIA JETSON TK1
    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.