Unable to connect to samba share from other machine


#1

Please help me to debug this, since the logging of the Samba package is not working (?)

Freshly installed Openwrt 18.06 on a WT3020.
Installed samba and created a share according this tutorial:

But I cannot connect to it from my other machines.

My smb.conf:

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

[homes]
        comment     = Home Directories
        browsable   = no
        read only   = no
        create mode = 0750

[openwrt]
        path = /mnt
        valid users = root
        read only = no
        guest ok = yes
        browseable = yes

Connecting from windows: This folder is empty.

From my rPi:

# mount -t cifs //192.168.XX.XX/openwrt /media/openwrt -o username=root,password=XXXX
Unable to find suitable address.

# smbclient //192.168.0.130/openwrt -U root
WARNING: The "syslog" option is deprecated
Connection to 192.168.XX.XX failed (Error NT_STATUS_CONNECTION_REFUSED)

Restarted multiple times, even disabled the Firewall but no luck...


#2

So connecting from Windows, you are able to connect properly?
You can also find the cifs guide in documentation. It lists various commands on how to successfully mount the network share. Search the documentation.


#3

No, also cannot connect from Windows, its just the error message


#4

Any idea? It is really frustrating to debug this


#5

What's the content of /etc/config/samba? Also provide the output of mount.


#6

/etc/config/samba


config samba
        option name 'OpenWrt'
        option workgroup 'WORKGROUP'
        option description 'OpenWrt'
        option homes '1'

config sambashare
        option browseable 'yes'
        option name 'openwrt'
        option read_only 'no'
        option guest_ok 'yes'
        option users 'openwrt'
        option path '/mnt'

mount:

/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/mtdblock6 on /overlay type jffs2 (rw,noatime)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)


#7

What type of device you're mounting to your router? I don't see any device being mounted on /mnt.

Secondly, your configuration is itself misleading, no wonder you're having issues. In /etc/config/samba you have openwrt as user but in smbd.conf you have root. I would strongly advise you to remove any content you have added in smbd.conf and keep it in default shape. You should only edit /etc/config/samba with proper config from LuCI and remove any input from users field and allow guests and then see how it goes. Once you have it working you can move to advance use cases.


#8

Okay, I figured the problem.
Samba was somehow bound to only the LoopBack interface.

root@OpenWrt:~# netstat -tulpn | grep smbd
tcp        0      0 127.0.0.1:139           0.0.0.0:*               LISTEN      1074/smbd
tcp        0      0 127.0.0.1:445           0.0.0.0:*               LISTEN      1074/smbd
tcp        0      0 fe80::2228:18ff:fea2:4b9e:139 :::*                    LISTEN      1074/smbd
tcp        0      0 ::1:139                 :::*                    LISTEN      1074/smbd
tcp        0      0 fe80::2228:18ff:fea2:4b9e:445 :::*                    LISTEN      1074/smbd
tcp        0      0 ::1:445                 :::*                    LISTEN      1074/smbd

So I modified this config option in the SMB.conf:
bind interfaces only = yes -> no

and alas:

root@OpenWrt:~# netstat -tulpn | grep smbd
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      1072/smbd
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      1072/smbd
tcp        0      0 :::139                  :::*                    LISTEN      1072/smbd
tcp        0      0 :::445                  :::*                    LISTEN      1072/smbd

#9

In your config the interface is set to lo br-lan which means both loopback and lan. So it should work on both interfaces. Also as I said before it's best to start from default config for your use case and, once everything starts working, work yoir way up to what you want to achieve. This will make sure you dont get in problems in the future.


#10

You are limiting SMB to v1 via max protocol = SMB1, but since 10 months Windows 10 disables/uninstalls SMBv1 support by default, because its a old protocol with security problems.
So you either have to delete this line and allow the default SMBv2 as max protocol or enable SMBv1 support in Windows 10 via Control Panel "Programs and Features/Turn Windows Features on or off/SMB 1.0 ...".

PS: the snapshots builds have Samba4 support with SMBv3 support, which is the default for Windows 10 machines.