Share USB-disk on the LAN

I want to have my Router's USB connected harddisk shared on the internal network.
I have followed these guides:
https://openwrt.org/docs/guide-user/services/nas/cifs.server
https://openwrt.org/docs/guide-user/services/nas/samba

The USB storage itself seems to work (I can trough SSH on the router, read and write files)

But i can not see or access the USB storage from the network.
What could be wrong?
I suspect either the samba server is not correct configured, or the firewall on the router is not allowing the samba.

I have a Netgear WNDR3800 flashed with LibreCMC 1.5 (Which should correspond to the OpenWRT 19.07)
The only thing that was not working according to the guides i was following, is that the luci-app-samba is not in the LibreCMC repositories. (But it is as i understand not needed)

The firewall should be open for the LAN network.
You can check it works from the router using "smbclient".
Check that the Windows machines are configured as connected to a private network, not a public one.
Share your config files and tests here.

1 Like

Thanks for quick reply!

If i have an "untouched" firewall setting from the LibreCMC install, then i do not need to open the following ports:
UDP 137 - NetBIOS Name Service
UDP 138 - NETBIOS Datagram Service
TCP 139 - NETBIOS Session Service
TCP 445 - Microsoft Directory Services
According to this guide:
https://openwrt.org/docs/guide-user/services/nas/cifs.server

Do i need to install the samba36-client in order to "check it works from the router using "smbclient"."?

I do most of the configurations from a Fedora machine, but i have a Mac and a Windows10 pc that needs to access the drive as well. None of the systems can see the routers usb-harddisk at the moment.

Here are the config files:

/etc/config/samba

config samba
        option 'name'                   'libreCMC'
        option 'workgroup'              'WORKGROUP'
        option 'description'            'libreCMC'
        option 'homes'                  '0'
        option 'interface'              'loopback lan'

config 'sambashare'
        option 'read_only' 'yes'
        option 'create_mask' '0700'
        option 'dir_mask' '0700'
        option 'name' 'storage'
        option 'path' '/mnt/sda'
        option 'guest_ok' 'yes'

And from /etc/samba/smb.conf.template

[global]
        netbios name = libreCMC
        display charset = UTF-8
        interfaces = lo br-lan
        server string = libreCMC
        unix charset = UTF-8
        workgroup = WORKGROUP
        bind interfaces only = yes
        deadtime = 30
        enable core files = no
        invalid users = root
        local master = no
        map to guest = Bad User
        max protocol = SMB2
        min receivefile size = 16384
        null passwords = yes
        passdb backend = smbpasswd
        security = share
        smb passwd file = /etc/samba/smbpasswd
        use sendfile = yes

1 Like

Yes, install the client package and try from the router.

Hmm, now i am not even able to download packages. I get this error:

Collected errors:
 * opkg_download: Failed to download https://librecmc.org/librecmc/downloads/snapshots/v1.5.0/targets/ath79/generic/packages/Packages.gz, wget returned 8.
 * opkg_download: Failed to download https://librecmc.org/librecmc/downloads/snapshots/v1.5.0/packages/mips_24kc/base/Packages.gz, wget returned 8.
 * opkg_download: Failed to download https://librecmc.org/librecmc/downloads/snapshots/v1.5.0/packages/mips_24kc/packages/Packages.gz, wget returned 8.

I think i will make a reset of the router and start over.

Hmm, a reset of the router did not removed the error from the opkg_download.
But now I can see that the LibreCMC repos has changed from 1.5.0 to 1.5.0a.
I will give it another try, and come back when i get stucked again...

Keep in mind you don't see smb shares by default, for Windows you need the wsdd2 package and for Linux/MacOS you need Avahi. Yet avahi support is only working for samba4 or ksmbd with ksmbd-avahi-service.

Without those extra packages to discover the shares in explorer/finder, you need to use the UNC network path, this is your routers hostname or ip and than the samba sharename. So something like \\openwrt\share, you can check the hostname via shell by typing hostname.

1 Like

Thanks for input.
I am OK, with a solution where I need to know the IP and samba share-name of the router.
I do not need to be able to discover the shares in explorer/finder.

Now back on track.
The issues i was facing regarding not being able to install packages, was because of an outdated version of the LibreCMC i was using.
https://gogs.librecmc.org/libreCMC/libreCMC/issues/120

Now i can read the drive from the network, but i can not write to the drive from the network.

How should I use smbclient in order to check what could be wrong?

The config you posted has option read_only 'yes'.

1 Like

Correct, but it was not the showstopper in the end.

The magic trick was this command:

root@libreCMC:~# chmod -R 777 /mnt/sda

But i do not understand these permission rules.
I also have this in /etc/config/samba

        option 'create_mask' '0700'
        option 'dir_mask' '0700'

It works, but i dont know if i have open op for too much permissions.

The Samba server likely runs as a user other than root. The more secure way would be to change ownership of the shared directory root (/mnt/sda) to the Samba user. '700' allows only the owner of the directory access. '777' allows anyone to read or write.

Note that homing Samba to /mnt/sda makes the entire disk shared and remotely writeable. You may not want to do that either.