"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



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)