Page MenuHomeSolus

Unable to create local Samba share
Closed, ResolvedPublic

Description

Under Plasma (and possibly other flavors of Solus), Samba share cannot be created: Dolphin will return error net usershare add: cannot convert name "Everyone" to a SID. The transport connection is now disconnected. Looking at journalctl, the following is logged:

2023-01-01 21 h 56 dolphin !!! applying changes !!! true "Public" false "Everyone:r" "/home/my_home/Public"
2023-01-01 21 h 56 audit AVC apparmor="DENIED" operation="open" profile="samba-dcerpcd" name="/usr/share/defaults/samba/smb.conf" pid=3777 comm="samba-dcerpcd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
2023-01-01 21 h 56 audit SYSCALL arch=c000003e syscall=257 success=no exit=-13 a0=ffffff9c a1=5565e32f7230 a2=0 a3=0 items=0 ppid=3776 pid=3777 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="samba-dcerpcd" exe="/usr/lib64/samba/samba/samba-dcerpcd" subj=samba-dcerpcd key=(null)
2023-01-01 21 h 56 audit PROCTITLE proctitle=2F7573722F6C696236342F73616D62612F73616D62612F73616D62612D64636572706364002D2D6C6962657865632D7270636473002D2D72656164792D7369676E616C2D66643D3239002D2D6E702D68656C706572002D2D64656275676C6576656C3D31
2023-01-01 21 h 56 dolphin kf.kio.core: We got some errors while running 'net usershare add' ("usershare", "add", "Public", "/home/my_home/Public", "", "Everyone:r", "guest_ok=n")
2023-01-01 21 h 56 dolphin kf.kio.core: "net usershare add: cannot convert name \"Everyone\" to a SID. The transport connection is now disconnected..\n"

Seems like Samba 4.16 requires many rules to be added to AppArmor and Solus misses a few. See this ticket as reference: https://bugs.archlinux.org/task/74614

Event Timeline

This comment was removed by 10leej.
ermo added a subscriber: ermo.

@ReillyBrogan when you get the time, could you look into this re. kernel + apparmor update pass?

The error relating to apparmor seems to be gone but I still cannot share folders and this error is displayed in Dolphin (my approximative translation):

Unable to share this folder as the group owner of /var/lib/samba/usershare is wrongly set to users. You can correct this by changing the group owner of this folder to usershares and becoming member of this group...

I don't have any settings defined in /etc/samba/smb.conf. Both smb and nmb services are running and I defined a samba user with a password.

Additional info:

myusername@plasma ~ $ ls -lisa /var/lib/samba
total 1260
917770   4 drwxr-xr-x  5 root root    4096  2 mai 16:48 .
917766   4 drwxr-xr-x 30 root root    4096  3 mai  2023 ..
920207 412 -rw-------  1 root root  421888  2 mai 16:46 account_policy.tdb
917772   4 drwxrwx---  2 root root    4096 30 déc 01:45 bind-dns
920195   4 -rw-------  1 root root     696  2 mai 16:46 group_mapping.tdb
917771   4 drwx------  3 root root    4096  2 mai 16:48 private
920210 412 -rw-------  1 root root  421888  2 mai 16:48 registry.tdb
920378 412 -rw-------  1 root root  421888  2 mai 16:48 share_info.tdb
917773   4 drwxrwx--T  2 root users   4096 11 jui  2021 usershare

myusername@plasma ~ $ groups
myusername dialout audio video cdrom lpadmin sudo scanner plugdev users fuse

@clauded

I'm working on an update to samba in the 4.16.x series that will attempt to fix this issue.

However, this involves another important moving part that will need to be properly integrated with solus before the samba change can be landed.

Please stay tuned and thanks for reporting.

ermo changed the task status from Open to In Progress.May 4 2023, 2:00 PM
ermo claimed this task.
ermo triaged this task as Normal priority.
ermo added a subscriber: ReillyBrogan.

The sambashares related issue was resolved in R2842:8108ccd2b475.

However, I have narrowed down a subsequent issue, which appears to be related to a missing AppArmor-related setting re. the custom stateless solus samba config:

Profile: samba-dcerpcd
Operation: open
Name: /usr/share/defaults/samba/smb.conf
Denied: r
Logfile: /var/log/audit/audit.log

I'm currently debating what the best option is re. samba; one option is to add a custom rule, another option is to disable AppArmor for samba completely.