[SOLVED] Samba usershares created in Nemo don't work

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
stoffl
Level 2
Level 2
Posts: 59
Joined: Sun Sep 21, 2014 5:48 am

[SOLVED] Samba usershares created in Nemo don't work

Post by stoffl »

I try to share drives on my network with samba. I've used Nemo to create two test shares, one is a USB drive, the other a directory in my home directory.

I can see the shares with net usershare:

Code: Select all

$ net usershare info -l
[temp]
path=/home/mike/temp
comment=
usershare_acl=Everyone:R,Unix User\mike:F,
guest_ok=y

[UsbShared]
path=/media/mike/UsbShared
comment=
usershare_acl=Everyone:F,
guest_ok=y
I can see my Linux SMB server e.g. from my Windows 10 host (with the help of the WSDD daemon from here). But the shares above are not there. I only see my printer. I've also checked with smbclient on my Linux host. The shares are not listed:

Code: Select all

$ smbclient -L 127.0.0.1
Enter WORKGROUP\mike's password: 

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        IPC$            IPC       IPC Service (Nilar server (Samba, Ubuntu))
        DCPJ562DW       Printer   DCPJ562DW
        Brother_DCP_J562DW Printer   Brother DCP-J562DW
SMB1 disabled -- no workgroup available
Restarting smbd doesn't help. I think my smb.conf is still default. The usershare config there is:

Code: Select all

# Maximum number of usershare. 0 means that usershare is disabled.
#   usershare max shares = 100

# Allow users who've been granted usershare privileges to create
# public shares, not just authenticated ones
   usershare allow guests = yes
Also the required samba packages are there I think:

Code: Select all

# dpkg -l | grep samb
ii  python3-samba                              2:4.11.6+dfsg-0ubuntu1.6            amd64        Python 3 bindings for Samba
ii  samba                                      2:4.11.6+dfsg-0ubuntu1.6            amd64        SMB/CIFS file, print, and login server for Unix
ii  samba-common                               2:4.11.6+dfsg-0ubuntu1.6            all          common files used by both the Samba server and client
ii  samba-common-bin                           2:4.11.6+dfsg-0ubuntu1.6            amd64        Samba common files used by both the server and the client
ii  samba-dsdb-modules:amd64                   2:4.11.6+dfsg-0ubuntu1.6            amd64        Samba Directory Services Database
ii  samba-libs:amd64                           2:4.11.6+dfsg-0ubuntu1.6            amd64        Samba core libraries
ii  samba-vfs-modules:amd64                    2:4.11.6+dfsg-0ubuntu1.6            amd64        Samba Virtual FileSystem plugins
System specs:

Code: Select all

# inxi -Fxxxrz                                                                                                                               
System:    Kernel: 5.4.0-70-generic x86_64 bits: 64 compiler: gcc v: 9.3.0 Desktop: Cinnamon 4.8.6 wm: muffin 4.8.1                                   
           dm: LightDM 1.30.0 Distro: Linux Mint 20.1 Ulyssa base: Ubuntu 20.04 focal                                                                 
Machine:   Type: Desktop Mobo: ASRock model: B85M-ITX serial: <filter> UEFI [Legacy]: American Megatrends v: P2.50                                    
           date: 01/07/2016                                                                                                                           
CPU:       Topology: Quad Core model: Intel Core i7-4790K bits: 64 type: MT MCP arch: Haswell rev: 3 L1 cache: 256 KiB                                
           L2 cache: 8192 KiB L3 cache: 8192 KiB                                                                                                      
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 63984                                                            
           Speed: 2500 MHz min/max: 800/4400 MHz Core speeds (MHz): 1: 2433 2: 2486 3: 2425 4: 2401 5: 2415 6: 2400 7: 2497                           
           8: 2435                                                                                                                                    
Graphics:  Device-1: Intel Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics vendor: ASRock driver: i915 v: kernel                           
           bus ID: 00:02.0 chip ID: 8086:0412                                                                                                         
           Display: server: X.Org 1.20.9 driver: modesetting unloaded: fbdev,vesa resolution: 1920x1200~60Hz                                          
           OpenGL: renderer: Mesa DRI Intel HD Graphics 4600 (HSW GT2) v: 4.5 Mesa 20.2.6 compat-v: 3.0 direct render: Yes                            
Audio:     Device-1: Intel Xeon E3-1200 v3/4th Gen Core Processor HD Audio vendor: ASRock driver: snd_hda_intel v: kernel                             
           bus ID: 00:03.0 chip ID: 8086:0c0c                                                                                                         
           Device-2: Intel 8 Series/C220 Series High Definition Audio vendor: ASRock driver: snd_hda_intel v: kernel                                  
           bus ID: 00:1b.0 chip ID: 8086:8c20                                                                                                         
           Device-3: Sennheiser Headset [PC 8] type: USB driver: hid-generic,snd-usb-audio,usbhid bus ID: 3-10:8                                      
           chip ID: 1395:0025                                                                                                                         
           Sound Server: ALSA v: k5.4.0-70-generic
Network:   Device-1: Qualcomm Atheros QCA8171 Gigabit Ethernet vendor: ASRock driver: alx v: kernel port: e000 bus ID: 02:00.0                        
           chip ID: 1969:10a1                                                                                                                         
           IF: enp2s0 state: up speed: 1000 Mbps duplex: full mac: <filter>                                                                           
           IF-ID-1: br-0708d7f6c1ee state: down mac: <filter> 
           IF-ID-2: br-0bee92ea8a84 state: up speed: N/A duplex: N/A mac: <filter> 
           IF-ID-3: br-0f30b99544c7 state: down mac: <filter> 
           IF-ID-4: br-19a5be7de673 state: down mac: <filter> 
           IF-ID-5: br-1f1a0ba098d7 state: up speed: N/A duplex: N/A mac: <filter> 
           IF-ID-6: br-23d919f12227 state: down mac: <filter> 
           IF-ID-7: br-304a31a943c7 state: down mac: <filter> 
           IF-ID-8: br-45d557f38df6 state: down mac: <filter> 
           IF-ID-9: br-4b27d052f385 state: down mac: <filter> 
           IF-ID-10: br-4c9762fcb45f state: down mac: <filter> 
           IF-ID-11: br-5947065df481 state: down mac: <filter> 
           IF-ID-12: br-66d696710f86 state: down mac: <filter> 
           IF-ID-13: br-686c84a4a771 state: down mac: <filter> 
           IF-ID-14: br-6b4be36e24ec state: down mac: <filter> 
           IF-ID-15: br-77dc7dba2b5f state: down mac: <filter> 
           IF-ID-16: br-7f35da1c7736 state: down mac: <filter> 
           IF-ID-17: br-8d27d8400b76 state: down mac: <filter> 
           IF-ID-18: br-8de0d8d850ed state: down mac: <filter> 
           IF-ID-19: br-95de7a6a1085 state: up speed: N/A duplex: N/A mac: <filter> 
           IF-ID-20: br-a95f4454d9d8 state: down mac: <filter> 
           IF-ID-21: br-b969b41b53f2 state: down mac: <filter> 
           IF-ID-22: br-bd52899c321b state: up speed: N/A duplex: N/A mac: <filter> 
           IF-ID-23: br-c2b0d63d50a2 state: down mac: <filter> 
           IF-ID-24: br-c4589aae8612 state: down mac: <filter> 
           IF-ID-25: br-e37aa878d075 state: down mac: <filter> 
           IF-ID-26: br-e55d7b906701 state: down mac: <filter> 
           IF-ID-27: br-ff6cecc2d135 state: down mac: <filter> 
           IF-ID-28: docker0 state: down mac: <filter> 
           IF-ID-29: veth0001fc0 state: up speed: 10000 Mbps duplex: full mac: <filter> 
           IF-ID-30: veth0b3c1ee state: up speed: 10000 Mbps duplex: full mac: <filter> 
           IF-ID-31: veth7f23812 state: up speed: 10000 Mbps duplex: full mac: <filter> 
           IF-ID-32: veth8157c1b state: up speed: 10000 Mbps duplex: full mac: <filter> 
           IF-ID-33: veth834f10a state: up speed: 10000 Mbps duplex: full mac: <filter> 
           IF-ID-34: vethc4724d3 state: up speed: 10000 Mbps duplex: full mac: <filter> 
           IF-ID-35: vethd7873e8 state: up speed: 10000 Mbps duplex: full mac: <filter> 
           IF-ID-36: vethdd3a9aa state: up speed: 10000 Mbps duplex: full mac: <filter>
Drives:    Local Storage: total: 931.52 GiB used: 90.73 GiB (9.7%) 
           ID-1: /dev/sda vendor: Samsung model: SSD 840 Series size: 232.89 GiB speed: 6.0 Gb/s serial: <filter> rev: 6B0Q 
           scheme: MBR 
           ID-2: /dev/sdb type: USB vendor: Western Digital model: WD7500BPVT-80HXZT3 size: 698.64 GiB rotation: 5400 rpm 
           serial: <filter> rev: 01.0 scheme: MBR 
Partition: ID-1: / size: 212.10 GiB used: 89.62 GiB (42.3%) fs: ext4 dev: /dev/dm-1 
           ID-2: /boot size: 703.5 MiB used: 307.9 MiB (43.8%) fs: ext4 dev: /dev/sda1 
           ID-3: swap-1 size: 15.66 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/dm-2 
Sensors:   System Temperatures: cpu: 38.0 C mobo: N/A 
           Fan Speeds (RPM): N/A 
Repos:     No active apt repos in: /etc/apt/sources.list 
           Active apt repos in: /etc/apt/sources.list.d/additional-repositories.list 
           1: deb https://dl.winehq.org/wine-builds/ubuntu/ focal main
           2: deb https://pkg.ltec.ch/public/ focal main
           Active apt repos in: /etc/apt/sources.list.d/google-earth-pro.list 
           1: deb [arch=amd64] http://dl.google.com/linux/earth/deb/ stable main
           Active apt repos in: /etc/apt/sources.list.d/josm.list 
           1: deb https://josm.openstreetmap.de/apt focal universe
           Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list 
           1: deb http://ftp.fau.de/mint/packages ulyssa main upstream import backport
           2: deb http://ftp.uni-mainz.de/ubuntu focal main restricted universe multiverse
           3: deb http://ftp.uni-mainz.de/ubuntu focal-updates main restricted universe multiverse
           4: deb http://ftp.uni-mainz.de/ubuntu focal-backports main restricted universe multiverse
           5: deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
           6: deb http://archive.canonical.com/ubuntu/ focal partner
           Active apt repos in: /etc/apt/sources.list.d/skype-stable.list 
           1: deb [arch=amd64] https://repo.skype.com/deb stable main
           Active apt repos in: /etc/apt/sources.list.d/spotify.list 
           1: deb http://repository.spotify.com stable non-free
Info:      Processes: 417 Uptime: 4d 1h 27m Memory: 15.30 GiB used: 4.18 GiB (27.3%) Init: systemd v: 245 runlevel: 5 
           Compilers: gcc: 9.3.0 alt: 7/9 Shell: bash (sudo) v: 5.0.17 running in: server inxi: 3.0.38
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
AndyMH
Level 21
Level 21
Posts: 13759
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Samba usershares created in Nemo don't work

Post by AndyMH »

Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
altair4
Level 20
Level 20
Posts: 11460
Joined: Tue Feb 03, 2009 10:27 am

Re: Samba usershares created in Nemo don't work

Post by altair4 »

So I tried to reproduce your symptoms using Mint20 Cinnamon. The only difference was I used the WSD steps outlined here in [Part 1b] WSD = WS-Discovery

Everything seems to work for me. Perhaps there is some anomaly in your smb.conf. Please post the output of the following command:

Code: Select all

testparm -s
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 20
Level 20
Posts: 11460
Joined: Tue Feb 03, 2009 10:27 am

Re: Samba usershares created in Nemo don't work

Post by altair4 »

I managed to break usershares. See if this situation applies:

THe permissions on /var/lib/samba/usershares has a specific setting. If you were to set the usershares folder to 0777:

Code: Select all

sudo chmod 0777 /var/lib/samba/usershares
It will disable usershares. You will no longer see usershares from smbclient or anywhere else.

If you did that set usershares back to where it was in the beginning:

Code: Select all

sudo chmod 1770 /var/lib/samba/usershares 
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
stoffl
Level 2
Level 2
Posts: 59
Joined: Sun Sep 21, 2014 5:48 am

Re: Samba usershares created in Nemo don't work

Post by stoffl »

@altair4 Thank you! That really was the problem! Usershares now work as expected.

But I never touched the permissions of this directory also did not use usershares before. I don't remember which version I initally installed but I did a couple of Mint upgrade cycles since. Could it be that the permissions were different in an earlier release? If so, is this worth a bug report so that the samba package can check the permissions when upgrading?
stoffl
Level 2
Level 2
Posts: 59
Joined: Sun Sep 21, 2014 5:48 am

Re: [SOLVED] Samba usershares created in Nemo don't work

Post by stoffl »

Sorry, that was too quick: Now I can't create usershares as normal user anymore. Who should own this directory? Should group owner maybe be set to the sambashare group (were I'm part of)? Right now owner and group are both root:

Code: Select all

# ls -ld /var/lib/samba/usershares/
drwxrwx--T 2 root root 4096 Mär 23 08:48 /var/lib/samba/usershares/
altair4
Level 20
Level 20
Posts: 11460
Joined: Tue Feb 03, 2009 10:27 am

Re: [SOLVED] Samba usershares created in Nemo don't work

Post by altair4 »

The way usershares work is it has to have the 1770 permissions and it has to have group = sambashare. This limits who can create shares to only users who are members of that group.

So:

Code: Select all

sudo chown :sambashare /var/lib/samba/usershares 
You just need to remember to add yourself to the sambashare group. If you are the first user you should already be a member. If not add yourself:

Code: Select all

sudo gpasswd -a your-user-name sambashare
Then logout and log in again.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
stoffl
Level 2
Level 2
Posts: 59
Joined: Sun Sep 21, 2014 5:48 am

Re: [SOLVED] Samba usershares created in Nemo don't work

Post by stoffl »

Thanks for confirming. Changing group owernship to sambashare fixed it.

Like I said, I already was part of that group, so modifying shares works fine now. I still wonder, how the permissions of that directory got changed.
altair4
Level 20
Level 20
Posts: 11460
Joined: Tue Feb 03, 2009 10:27 am

Re: [SOLVED] Samba usershares created in Nemo don't work

Post by altair4 »

That I do not know. I remember somewhere in the distant past that the debian based LMDE version of Mint really messed up the usershares folder. I don't remember this happening to the Ubuntu based versions of Mint but .....
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Locked

Return to “Networking”