'net usershare' returned error 255 on jammy-desktop-amd64

Bug #1967245 reported by XingChang
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
nautilus-share (Ubuntu)
Fix Released
High
Andreas Hasenack

Bug Description

jammy-desktop-amd64.iso 2022-03-26 08:25

'net usershare' returned error 255: net usershare add: cannot convert name "Everyone" to a SID. Access denied.

Tags: jammy

Related branches

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Is this what you saw?

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

execsnoop tells me this is the command being run:

net 5212 3561 0 /usr/bin/net usershare add -l Public /home/andreas/Public Everyone:R,andreas:F guest_ok=y

or this, without guest access:

net 5779 3561 0 /usr/bin/net usershare add -l Public /home/andreas/Public Everyone:R,andreas:F guest_ok=n

The default path for "usershare path" is /var/lib/samba/usershares, and it seems to be setup correctly:
drwxrwx--T 2 root sambashare 4,0K abr 4 09:46 /var/lib/samba/usershares/

For this version of samba at least, that command line won't work. There also seems to be a bug in the processing.

This works:
root@nsn7:~# net usershare add --long Public /home/andreas/Public somecomment Everyone:R,andreas:F guest_ok=y
[Public]
path=/home/andreas/Public
comment=somecomment
usershare_acl=Everyone:R,Unix User\andreas:F,
guest_ok=y

The short form of --long, -l, does not:
root@nsn7:~# net usershare add -l Public /home/andreas/Public somecomment Everyone:R,andreas:F guest_ok=y
[2022/04/04 10:00:33, 0] ../../lib/util/debug.c:1100(reopen_one_log)
  reopen_one_log: Unable to open new log file 'Public/log.net': No such file or directory
net usershare add: share name /home/andreas/public contains invalid characters (any of %<>*?|/\+=;:",)

Also, the command issued by gnome seems to be missing the comment, notice how I added "somecomment" above.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Ok, the <comment> was passed as an empty space, I missed that in my copy paste. This works:

root@nsn7:~# net usershare add --long Public /home/andreas/Public "" Everyone:R,andreas:F guest_ok=y
[Public]
path=/home/andreas/Public
comment=
usershare_acl=Everyone:R,Unix User\andreas:F,
guest_ok=y

Now on to -l vs --long. In Ubuntu Impish, "-l" is used, and it works. In Jammy, -l seems to imply a logging option:
root@nsn7:~# net usershare add -l Public /home/andreas/Public "" Everyone:R,andreas:F guest_ok=y
[2022/04/04 10:09:05, 0] ../../lib/util/debug.c:1100(reopen_one_log)
  reopen_one_log: Unable to open new log file 'Public/log.net': No such file or directory
net usershare add: share name /home/andreas/public contains invalid characters (any of %<>*?|/\+=;:",)

Must be part of the command-line revamp announced in 4.15.0[1]. Indeed:

"""
net:
-l is not available for --long anymore
"""

1. https://www.samba.org/samba/history/samba-4.15.0.html

affects: samba (Ubuntu) → nautilus-share (Ubuntu)
Changed in nautilus-share (Ubuntu):
status: New → Confirmed
assignee: nobody → Andreas Hasenack (ahasenack)
status: Confirmed → In Progress
importance: Undecided → High
Jeremy Bícha (jbicha)
tags: added: jammy
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package nautilus-share - 0.7.3-2ubuntu6

---------------
nautilus-share (0.7.3-2ubuntu6) jammy; urgency=medium

  * d/p/05_usershare_cmdline_new_samba.patch: update net usershare
    command-line for samba 4.15.x (LP: #1967245)

 -- Andreas Hasenack <email address hidden> Mon, 04 Apr 2022 10:28:36 -0300

Changed in nautilus-share (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
XingChang (xingchang) wrote :
Revision history for this message
XingChang (xingchang) wrote :

'net usershare' returned error 255: this works ok.
guest can not visit the share path /home/vm/share, but able to visit /var/samba.
the same /etc/samba/smb.conf works on ubuntu21,20,18,16.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Ok, that's a different issue, and a configuration one. You have to check the file permissions on /home, /home/vm and /home/vm/share and make sure the user guest is mapped to on the server can access those directories and the files in it. To find out which linux user on the server that is, check the "map to guest" and "guest account" parameters in smb.conf.

I will close this bug since the original issue, "net usershare", is now working. If you think there is still a problem with samba, please file a new bug for that specific issue describing the behavior.

Thanks for filing this bug, though, it was a real issue that we were able to fix because of this report.

Revision history for this message
XingChang (xingchang) wrote :

yes,thank you very much.
I add "guest account" to the [global], then I can visit the /home/vm/share now. it works all good.
thanks for your information.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.