"net usershare" has returned error 255

Could someone tell me why when I try to share a directory through caja-share the log.net tells me that the resource I am trying to share contains invalid characters when the resource in its name does not have any of these symbols or characters?

net usershare add: share name /home/user/Downloads contains invalid characters (any of %<>*?|/\+=;:",)

This also happens to me when I try to share the Documents, Music and Images directory.

I have configured samba in the best way and on other computers with different distribution of Ubuntu and Debian, but it is the first time I see this message, of coursethe first message that usually appears is the following: "net usershare" has returned error 255

Thanks for your help

Same issue on one pc but not on another.
22.04 clean install on release.

Same issue here. I installed 22.04 very recently. I followed https://fostips.com/share-folder-ubuntu-21-04-fix-net-share-error-255/, but it is not working.
Each time I try to share the folder /home/m/pubblici I get the same error:

net usershare add: share name /home/m/pubblici contains invalid characters (any of %<>*?|/+=;:",)

It happens the same with other folders too, for example when I try t share /home/m/musica I get:

net usershare add: share name /home/m/musica contains invalid characters (any of %<>*?|/+=;:",)

Any suggestion, please? Thanks.

Hi @Ma_N0

I found this information in the community, of course this doesn't solve the problem completely, what it does is to share the resource of your directory under the Public name whether it is called Documents, Images, Downloads or simply any other directory. As soon as you want to change the resource you shared it is simply rename it with the command:
net usershare add Public /home/$USER/Downloads : Everyone:F guest_ok=y

The original post is from user @apinunt in his help and support topic, which I leave a link to for your review: Sharing Public folders between computers over the network - #3 by apinunt

In any case, the topic is still open for anyone who has a complete answer to this problem.

How to make Linux enthusiasts move back to windows 101

1 Like

Q:

A:

By making them use the worst filesharing protocol ever invented from the most incompatible operating system ever invented.

Really, why are you guys still using that fisher-price protocol instead of one of the many mature native standard cross platform compatible protocols supported by linux ?

On linux mint forum I wrote detailed tutorial for folder sharing for Linux Mint Cinnamon and MATE and it should apply here as well for Ubuntu-mate. Some errors are actually bugs that might not prevent you from sharing folders. You might try step by step concentrating only on case A)

https://forums.linuxmint.com/viewtopic.php?f=42&t=353391

Hi @Ma_N0 @colinux

The solution I found is the following, compile from source caja-extensions. The problem is already patched from source.

Make sure you have the following dependencies installed:

:heavy_dollar_sign: In x-terminal-emulator:

sudo apt install autoconf-archive autopoint autopoint clang clang clang-tools gcc git libcaja-extension-dev libdbus-1-dev libdbus-glib-1-dev libdconf-dev libgtk-3-dev libgupnp-1.2-dev libgupnp-1.2-dev libmate-desktop-dev libstartup-notification0-dev libxml2-utils make mate-common pkg-config libgstreamer-plugins-base1.0-dev

Clone the repository to your home directory from the terminal

:heavy_dollar_sign: In x-terminal-emulator:

git clone https://github.com/mate-desktop/caja-extensions.git

Access the location of the directory you cloned

:heavy_dollar_sign: In x-terminal-emulator:

cd caja-extensions

Enter the following command

:heavy_dollar_sign: In x-terminal-emulator:

./autogen.sh --prefix=/usr

Create and install the plugins

:heavy_dollar_sign: In x-terminal-emulator:

make && sudo make install

Restart the computer and you are done, I have tested this solution by myself.
If it worked for you let me know.

4 Likes

muchas gracias llevaba una semana rompiendome la cabeza tratado de compratir carpetas

2 Likes

Welcome @Miguel_Angel to the community!

I am running Mint 20.3 with Mate. The repository version of caja-share has not been updated to correct the net usershare error 255 issue.

Although my OS is a previous version, and Mint instead of Ubuntu, your solution worked perfectly, line-for-line as written, with no errors.

Thank you for posting this excellent solution.

3 Likes

Welcome @KenH2000 to the community!

1 Like

I just installed UM 20.04.6 (well it was a 20.04.5 iso on the usb stick but after updates it became .6) on my freshly upgraded with nvme ssd's and regular ssd's (only kept one very solid and made to last WD Red 2TB HDD in there, upgraded memory to maximum capacity, I'll have that one desktop running for a lonnnng time, I already had a graphics adapter way beyond what I needed).

Then I encountered this error when trying to do shares, I installed samba, I install caja-shares or such (I'm not on that desktop right now, but I think that's the packages's name). And I got that error, well both errors, was really dumbfounded as to why it was adding a dash "-" in front of the folders I wanted to share, of course none like that were named as such, I don't see why it would think so.

A few days ago I went ahead with your apparently working fix for that ridiculous bug (thank you very much) but when I wanted to do the first part in terminal

```
sudo apt install autoconf-archive autopoint autopoint clang clang clang-tools gcc git libcaja-extension-dev libdbus-1-dev libdbus-glib-1-dev libdconf-dev libgtk-3-dev libgupnp-1.2-dev libgupnp-1.2-dev libmate-desktop-dev libstartup-notification0-dev libxml2-utils make mate-common pkg-config libgstreamer-plugins-base1.0-dev
```

I saw that it wanted to bring in way more packages than indicated here, including the i386 database....I really, really don't want to install doubles of every packages in their 32 bit version I have installed (I could argue that it is an almost virgin install so far, only install chromium through snap and vlc so far, so it might not be too bad), I thought I was free forever from those packages now that WINE 7 and over doesn't need 32 bit packages to function, I unfortunately need it for a few applications and a few games that I wonderfully manage to emulate without an itch on older installs on the much less performant, at least outside cpu and video, instance of that desktop in the past.

Why does it want to bring in the package that install all those i386 architecture copy of the packages I already have in. That's one hell of a bug if it needs all of this (when I wanted to install your reasonable install line, as I said, it brought with it a lot, A LOT more dependencies and I want to know if I can skip any of them or are they all needed, because if I can skip the i386 architecture deb, I'll install Synaptic and install from there and uncheck it from the list when I check all those packages you say to install.

That said, I'm glad I found solutions somewhere, I thought it was restricted to UM users, but even regular plain Ubuntu users encounter this infamous "net usershare" has returned error 255 after some digging, it looks like it can affect anything based on Debian, at least from version 20.x.x and on

Hope you'll see this, I really hated having to install i386 mirror packages for WINE, which I unfortunately need, that or CrossOver, but my copy is now rather old (17). I was especially mad last time when I installed WINE 6.x and all those 32 bit packages before when a week later WINE 7 was released! (WINE 7 getting rid of that prerequisite).

Anyways, I've been yammering long enough, hope you can reassure me, it's my main hurdle right now, there's a win10 pro desktop in the house and it needs to have access to some files through LAN which will definitely be on my main desktop which has UM 20.04.6.

1 Like

Hi @whowasphone thank you for your good reviews. Regarding your question why install the i386 architecture copies I have no idea, although it would be nice as you say, just apply the dependencies with the architecture you currently have installed.

I would also like to know on your UM 20.04.06 which caja-share version you have installed.

On the other hand, these are instructions that I took from the official repository of the Mate desktop environment, I leave a link so you can detail more clearly.

You can also in this link go to the file named .build.yml, there you will find that the developer saved us a lot of time in researching each dependency, he attached the exact dependencies for some distributions, among which is Ubuntu.

I also found at the time very valuable information that helped me to solve the problem with caja-share, I leave the link if you want to investigate further. caja-share is not working on Ubuntu MATE 22.04 LTS, shows 'net usershare' returned error 255 in Folder Sharing window · Issue #111 · mate-desktop/caja-extensions · GitHub

What I did was to check if the bug was already patched from the source, I cloned the repository from the first link I left above, and placed it on my desktop

/home/user/Desktop/caja-extensions/share/shares.c

However, you can also do the same process without cloning the repo, from this link GitHub - mate-desktop/caja-extensions: Set of extensions for Caja, the MATE file manager Open the file shares.c and verify that the parameter argv[1] = "--long"; instead of argv[1] = "-l"; is there.

Here is a link for you to verify which parameter you must remove, in this file you will see that next to it there is a - sign and a + sign giving you to understand which parameter you must replace from the shares.c file.

https://launchpadlibrarian.net/601673077/108.patch

You could also choose to add a PPA, here is the link. caja-extensions fix samba share : Lena Voytek Check if in this case you end up adding dependencies for the 32-bit architecture, although I discarded this option because I wanted to compile from the caja-extensions source. I have not tried this option, but if you decide to do so you can choose to install a test machine in VirtualBox and verify.

I also clarify that UM 20.04 I do not use it for a long time and I do not know if these solutions can help you, also I would like to know what version of caja-share you currently have installed, since I applied these instructions to UM 22.04 at the time.

I hope I helped you, any other doubt you can leave it and if you solve your problem let me know.

3 Likes

Sorry for the late reply,

This was a great post, but I refuse to do work on my much stronger desktop with 20.04 LTS (it's .6 now I think, thinking of letting it upgrade to 22.04.x but I heard the problem continues on with 22.04 so that's not a solution. I'll connect my firefox account on the Ubuntu MATE desktop as soon as I am done cleaning up the office where the old win10 pro i5-2400 with ram too strong for it, it reduces it's strength from 1866 to 1333mhz.. I flagellate myself with. It's just that I'd really like to get all the music that's on that desktop, which is in my solarium, so, very cold as of now, it's 4 seasons Canada around here, that will help out with finishing up the last renovation touches/removal of old hardware from my office room. But, maybe, I will do something you described in here as I got a new desktop chair with head support (finally), the chairs in the solarium are not the best to play around on a desktop).

I'm wondering about what if I share a folder on this win10 desktop, although, weak, has quite a lot of space, except for the identical 1TB Toshiba HDD's in Raid 1 (I didn't do this, I bought it like that, I thought a worst-scenario helper like this for just 70 dollars back in 2020 and I got lazy once my paid weeks off work were over. Don't you worry I read your reply and emailed the text to myself so I can access it from anywhere, you really went ahead here.

To note, I did go and update the system of the Ubuntu MATE desktop that's so much stronger and actual than what I am using right now, kernels and everything, I don't think I have PPA's on it except for Mozilla, I use Mozilla VPN so I remember installing it. There was still a lot of errors regarding SAMBA that I had to look at, during the updating process and that was 2 weeks ago, I'm sure more updates are awaiting and the same will happen. So much so, I'm thinking of sharing a folder on one of that old desktop's 4TB WD Black HDD that's in it other than the 2 toshibas in RAID 1, and see if that gets seen over the LAN.

But it's not looking good, by now, as of last year july 19, when the old HDD, my system disk, lost no data, crapped out on the better desktop and then changed everything on it to m.2 nvme ssd's and regular ssd's, doubled memory, kept the one great HDD on it, where the data I want is, back then when it was maybe 20.04.4, it did install and recognize my lan printer/scanner and there was a blue HP icon in the notification zone at the top right, it's still not there. Something changed between 20.04.4 and later incarnations of 20.04 and 22.04 carried its issues. I'm almost to the point of just doing the switch already, bringing my beast desktop here and finally use it, and install avahi to get access to a drive on the win10 pro desktop over lan, I pulled this out before, it's been 4-5 years, so I'll go ahead with your very useful post and all the options in it. Sorry for the very late reply, I got discouraged because i'm a masochist, I want my office to be perfect when I finally bring in my real desktop and not my emergency desktop in there heh.

Thank you very much, will take time to go through your guide during the weekend and if things get resolved, you'll know.

2 Likes

There is a confusion as I see in the supposed solutions, because there are two files, the same happens with "httpd" and ".htaccess" in "/etc" THE SOLUTION "IS SIMPLE"

:yellow_circle: FIRST: You have to install the package: "samba-usershares"

:yellow_circle: SECOND: You only have to modify the file located in "/etc/samba/usershares.conf"
The lines:

usershare path = /home/user/folderx
usershare owner only = false

:yellow_circle: THIRD. Restart the "SAMBA" service
01

1 Like