Network share from windows to manjaro

I want Windows 11, which is on my LAN network, to get access to my home folder in Manjaro.
So I tried to enable sharing for my home folder, by right-clicking on it in dolphin, and going to the shares tab.
I created a usershares folder in var/lib/samba, because that’s what it said to do.
Then it told me to change ownership of that folder to sambashares.
So I did

sudo groupadd sambashares

and then I rebooted.
Then I did

sudo chown sambashares /var/lib/samba/usershares                                            

and I got

chown: invalid user: ‘sambashares’

What to do now?

inxi -F                                                                                      2 ✘ 
System:
  Host: manjaro Kernel: 6.5.11-1-MANJARO arch: x86_64 bits: 64
    Desktop: KDE Plasma v: 5.27.9 Distro: Manjaro Linux
Machine:
  Type: Desktop Mobo: ASUSTeK model: PRIME B365M-A v: Rev X.0x
    serial: <superuser required> UEFI: American Megatrends v: 2208
    date: 07/09/2021
Battery:
  ID-1: hidpp_battery_0 charge: 56% condition: N/A
CPU:
  Info: 8-core model: Intel Core i7-9700 bits: 64 type: MCP cache: L2: 2 MiB
  Speed (MHz): avg: 800 min/max: 800/4700 cores: 1: 800 2: 800 3: 800 4: 800
    5: 800 6: 800 7: 800 8: 800
Graphics:
  Device-1: Intel CoffeeLake-S GT2 [UHD Graphics 630] driver: i915 v: kernel
  Device-2: USB C Video Adaptor driver: N/A type: USB
  Device-3: Microdia USB Live camera driver: snd-usb-audio,uvcvideo
    type: USB
  Display: x11 server: X.Org v: 21.1.9 driver: X: loaded: modesetting
    dri: iris gpu: i915 s-res: 3840x1080 resolution: 1: 2560x1440 2: 1920x1080
  API: EGL v: 1.5 drivers: iris,swrast platforms: x11,surfaceless,device
  API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel mesa v: 23.1.9-manjaro1.1
    renderer: Mesa Intel UHD Graphics 630 (CFL GT2)
  API: Vulkan v: 1.3.269 drivers: intel surfaces: xcb,xlib
Audio:
  Device-1: Intel 200 Series PCH HD Audio driver: snd_hda_intel
  Device-2: Microdia USB Live camera driver: snd-usb-audio,uvcvideo
    type: USB
  API: ALSA v: k6.5.11-1-MANJARO status: kernel-api
  Server-1: PipeWire v: 0.3.85 status: active
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    driver: r8169
  IF: enp3s0 state: up speed: 1000 Mbps duplex: full mac: a8:5e:45:e2:87:3c
  Device-2: Realtek RTL8153 Gigabit Ethernet Adapter driver: r8152 type: USB
  IF: enp0s20f0u3u1 state: down mac: 00:e0:4c:68:51:92
Bluetooth:
  Device-1: Cambridge Silicon Radio Bluetooth Dongle (HCI mode) driver: btusb
    type: USB
  Report: rfkill ID: hci0 state: up address: see --recommends
Drives:
  Local Storage: total: 2.26 TiB used: 758.8 GiB (32.8%)
  ID-1: /dev/sda vendor: Kingston model: SA400S37480G size: 447.13 GiB
  ID-2: /dev/sdb vendor: Toshiba model: HDWD120 size: 1.82 TiB
Partition:
  ID-1: / size: 99.1 GiB used: 25.03 GiB (25.3%) fs: ext4 dev: /dev/sda4
  ID-2: /boot/efi size: 96 MiB used: 31.6 MiB (33.0%) fs: vfat
    dev: /dev/sda1
Swap:
  Alert: No swap data was found.
Sensors:
  System Temperatures: cpu: 30.0 C mobo: N/A
  Fan Speeds (rpm): N/A
Info:
  Processes: 303 Uptime: 1h 7m Memory: total: 16 GiB available: 15.49 GiB
  used: 5.15 GiB (33.3%) Shell: Zsh inxi: 3.3.31

Hi @shmu26,

This :point_down:

…changes the user ownership of the file. So, in effect what happened was, you created the group sambashares and not a user, and then you changed only the directory /var/lib/samba/usershares, and not its content’s user ownership with:

I think this will serve you better:

1 Like

The mentioned folder must be owned by root.

The group you created should have been a system group - so create new system grouip

sudo groupadd -r sambashare

You should simply make your user a member of the sambashares and make the folder owned by the group sambashare

sudo chown root:sambashare /var/lib/samba/usershares

Add your user to the new groiup

sudo gpasswd  -a $USER sambashare

Ensure permissions on the usershares folder to prevent users from deleting other users files/folders (even their home can be deleted)

chmod 1770 /var/lib/samba/usershares

Remember to logout if you are doing this as yourself - altered group permission/membership is only applied at login.

It appears to me you are mixing concepts

Accessing Manjaro from Windows requires Samba server installed and configured correct.

GVFS is a client side protocol - nothing to do with server side access to shares

The topic referred deals only with basic sharing - usershares is an advanced topic requiring more configuration.

For more infor read Enable Usershares part at Samba - ArchWiki

Remove the now obsolete sambashares group

sudo groupdel sambashares

I tried following the “How to” but when I got the step of
" GVFS


Open your file manager and enter the server name or IP address in location bar."

It seemed like this step was inappropriate, because I already have access from Manjaro to my Windows machine. Now, I want access to my Manjaro machine, from Windows.

Well, whether the step is or not, doesn’t make the rest of the tutorial inapplicable.

Also, without knowing exactly what happened, how it’s happening, where or when it’s happening, I can’t say if it applies or not.

I’d recommend following @linux-aarhus’ advice on this.

Thanks, I did

sudo groupadd -r sambashare
sudo chown root:sambashare /var/lib/samba/usershares
sudo chmod 1770 /var/lib/samba/usershares
sudo gpasswd  -a $USER sambashare

logout
sudo groupdel sambashares
and now when I do a right-click on my home folder and go to the share tab, it says

Maybe I need to add root permissions to sambashare group?

You need to create a folder inside the usershares - then share that folder

You also need a correctly configured /etc/samba/smb.conf
You also need the samba service running

I want to share the Downloads folder in my Home folder

Check that these packages are installed:

  • samba
  • smbclient
  • gvfs
  • gvfs-smb
  • kdenetwork-filesharing
  • manjaro-settings-samba

I never used usershares - my assumption was not correct - you don’t need to create such folder.

 $ cat /etc/samba/smb.conf
[global]
  usershare path = /var/lib/samba/usershares
  usershare max shares = 100
  usershare allow guests = yes
  usershare owner only = yes
sudo systemctl enable --now smb

No - not necessary - check if your user has been applied the sambashare group

groups

sddm may have cached your permissions - so simply logging out may not do it.

Select Others from the login screen - then navigate back and login again.

When group and permissions are correct

If you are completely stuck

  • recheck your smb.conf
    cat /etc/samba/smb.conf
    
  • test your samba config
    sudo testparm /etc/samba/smb.conf
    
  • ensure the samba service is enabled and running
    systemctl status smb
    
  • recheck your groups
    groups
    
  • recheck permissions on /var/lib/samba/usershares
     $ ls -l /var/lib/samba
    total 1240
    -rw------- 1 root root       421888 nov 27 10:39 account_policy.tdb
    drwxrwx--- 1 root root            0 sep  4 16:33 bind-dns
    -rw------- 1 root root          696 nov 27 10:39 group_mapping.tdb
    drwx------ 1 root root           58 nov 27 10:39 private
    -rw------- 1 root root       421888 nov 27 10:39 registry.tdb
    -rw------- 1 root root       421888 nov 27 10:39 share_info.tdb
    drwxrwx--T 1 root sambashare      0 nov 27 10:36 usershares
    
1 Like

That was a good trick!
Now I see like this:


And when I try accessing my home folder from Windows, by typing the IP address in Windows explorer, I see a folder called “public”.
But how do I get to my home folder?

cat /etc/samba/smb.conf                                                                        ✔ 
[global]
   workgroup = MANJARO
   server string = Manjaro Samba Server
   server role = standalone server
   log file = /var/log/samba/log.%m
   max log size = 50
   guest account = nobody
   map to guest = Bad Password
usershare path = /var/lib/samba/usershares
  usershare max shares = 100
  usershare allow guests = yes
  usershare owner only = yes
   
   min protocol = SMB2
   max protocol = SMB3

[public]
   path = /srv/samba/share-name
   public = yes
   writable = yes
   printable = no

    ~  sudo testparm /etc/samba/smb.conf                                                              ✔ 
[sudo] password for shmuel: 
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Weak crypto is allowed by GnuTLS (e.g. NTLM as a compatibility fallback)

WARNING: 'workgroup' and 'netbios name' must differ.

Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

# Global parameters
[global]
        log file = /var/log/samba/log.%m
        map to guest = Bad Password
        max log size = 50
        server min protocol = SMB2
        server role = standalone server
        server string = Manjaro Samba Server
        usershare allow guests = Yes
        usershare max shares = 100
        workgroup = MANJARO
        idmap config * : backend = tdb


[public]
        guest ok = Yes
        path = /srv/samba/share-name
        read only = No
    ~  systemctl status smb                                                                   ✔  11s  
● smb.service - Samba SMB Daemon
     Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; preset: disabled)
     Active: active (running) since Mon 2023-11-27 11:39:17 IST; 1h 1min ago
       Docs: man:smbd(8)
             man:samba(7)
             man:smb.conf(5)
   Main PID: 7547 (smbd)
     Status: "smbd: ready to serve connections..."
      Tasks: 3 (limit: 19000)
     Memory: 13.8M
        CPU: 3.664s
     CGroup: /system.slice/smb.service
             ├─7547 /usr/bin/smbd --foreground --no-process-group
             ├─7551 "smbd: notifyd "
             └─7552 "smbd: cleanupd"

Nov 27 12:13:17 manjaro smbd[13849]: [2023/11/27 12:13:17.353376,  0] ../../source3/smbd/smb2_service.c:746(m>
Nov 27 12:13:17 manjaro smbd[13849]:   make_connection_snum: canonicalize_connect_path failed for service pub>
Nov 27 12:13:17 manjaro smbd[13849]: [2023/11/27 12:13:17.354441,  0] ../../source3/smbd/smb2_service.c:746(m>
Nov 27 12:13:17 manjaro smbd[13849]:   make_connection_snum: canonicalize_connect_path failed for service pub>
Nov 27 12:13:17 manjaro smbd[13849]: [2023/11/27 12:13:17.355385,  0] ../../source3/smbd/smb2_service.c:746(m>
Nov 27 12:13:17 manjaro smbd[13849]:   make_connection_snum: canonicalize_connect_path failed for service pub>
Nov 27 12:13:26 manjaro smbd[13849]: [2023/11/27 12:13:26.338101,  0] ../../source3/param/loadparm.c:3480(pro>
Nov 27 12:13:26 manjaro smbd[13849]:   process_usershare_file: stat of /var/lib/samba/usershares/home failed.>
Nov 27 12:13:26 manjaro smbd[13849]: [2023/11/27 12:13:26.380208,  0] ../../source3/param/loadparm.c:3480(pro>
Nov 27 12:13:26 manjaro smbd[13849]:   process_usershare_file: stat of /var/lib/samba/usershares/home failed.>
...skipping...
● smb.service - Samba SMB Daemon
     Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; preset: disabled)
     Active: active (running) since Mon 2023-11-27 11:39:17 IST; 1h 1min ago
       Docs: man:smbd(8)
             man:samba(7)
             man:smb.conf(5)
   Main PID: 7547 (smbd)
     Status: "smbd: ready to serve connections..."
      Tasks: 3 (limit: 19000)
     Memory: 13.8M
        CPU: 3.664s
     CGroup: /system.slice/smb.service
             ├─7547 /usr/bin/smbd --foreground --no-process-group
             ├─7551 "smbd: notifyd "
             └─7552 "smbd: cleanupd"

Nov 27 12:13:17 manjaro smbd[13849]: [2023/11/27 12:13:17.353376,  0] ../../source3/smbd/smb2_service.c:746(m>
Nov 27 12:13:17 manjaro smbd[13849]:   make_connection_snum: canonicalize_connect_path failed for service pub>
Nov 27 12:13:17 manjaro smbd[13849]: [2023/11/27 12:13:17.354441,  0] ../../source3/smbd/smb2_service.c:746(m>
Nov 27 12:13:17 manjaro smbd[13849]:   make_connection_snum: canonicalize_connect_path failed for service pub>
Nov 27 12:13:17 manjaro smbd[13849]: [2023/11/27 12:13:17.355385,  0] ../../source3/smbd/smb2_service.c:746(m>
Nov 27 12:13:17 manjaro smbd[13849]:   make_connection_snum: canonicalize_connect_path failed for service pub>
Nov 27 12:13:26 manjaro smbd[13849]: [2023/11/27 12:13:26.338101,  0] ../../source3/param/loadparm.c:3480(pro>
Nov 27 12:13:26 manjaro smbd[13849]:   process_usershare_file: stat of /var/lib/samba/usershares/home failed.>
Nov 27 12:13:26 manjaro smbd[13849]: [2023/11/27 12:13:26.380208,  0] ../../source3/param/loadparm.c:3480(pro>
Nov 27 12:13:26 manjaro smbd[13849]:   process_usershare_file: stat of /var/lib/samba/usershares/home failed.>
~
lines 1-26/26 (END)

groups                                                                                         ✔ 
sys network power vboxusers sambashare plugdev autologin lp wheel shmuel
    ~  ls -l /var/lib/samba                                                                           ✔ 
total 1360
-rw------- 1 root root       421888 Nov 15 19:14 account_policy.tdb
drwxrwx--- 2 root root         4096 Sep  4 17:33 bind-dns
-rw------- 1 root root          696 Nov 15 19:14 group_mapping.tdb
drwx------ 3 root root         4096 Nov 15 19:22 private
-rw------- 1 root root       528384 Nov 15 19:50 registry.tdb
-rw------- 1 root root       421888 Nov 15 19:22 share_info.tdb
drwxrwx--T 2 root sambashare   4096 Sep 24  2022 usershare
drwxrwx--T 3 root sambashare   4096 Nov 27 12:07 usershares

Yes, that is your “public”.
If the path is incorrect (/srv/samba/share-name) change it to where the share should be.

It seems you want to share /var/lib/samba/usershares. There are some really knowledgeble people in here, and they said nothing about that, but I would argue to maybe not use /usr/share for this?

But the reason your “public” is empty (if it is) is because the path is /srv/samba/share-name (witch I argue is a way better path to use)

1 Like

Windows and Manjaro should be in the same workgroup. If you use a named workgroup in Windows, you can use that one; or, even leave it set to workgroup = WORKGROUP if no other computers on your LAN have workgroup names set.

Verify the SMB protocol that Windows is using; I suspect SMB3 if it’s a later version of Windows 10/11. That being the case, just use:

protocol = SMB3 in smb.conf (one line, no min/max needed)

Under [Public] the path = line should reflect the folder you wish to share – /home/your_username/Downloads is what you wanted; though I generally don’t recommend sharing a folder within the user profile.

I’ll throw in a tiny tutorial on how I deal with this stuff.

$ sudo nano /etc/samba/smb.conf

[Name-of-the-share]
path = /path/to/what/you/want/to/share/
browsable = yes
writable = yes
read only = no
force user = YOUR_USERNAME # your username in Manjaro, not the user you create to login with below
create mask = 0644
public = no

Add a samba user (change “sambauser” to whatever username you want) and add samba password. This is the username and password you use when connecting in windows:

sudo useradd --system --no-create-home --no-user-group --shell /usr/bin/nologin sambauser
sudo smbpasswd -a sambauser

Enable the smaba systemd service:

sudo systemctl enable --now smb.service

Bonus, if you use KDE plasma (SDDM), hide the sambauser in the login screen:

$ sudo nano /etc/sddm.conf

[Users]
HideUsers=sambauser
1 Like

That’s it.

Good advice.

Just one more point that wasn’t mentioned yet: firewall needs to be turned off, or configured for samba, otherwise the share won’t work.

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.