# Why can't the Windows clients see my FreeBSD machine?



## knightjp (Jul 26, 2022)

I'm trying to share a couple of folders through samba. Basically share a couple folders of movies and tv shows. I followed this 
https://vermaden.wordpress.com/2018/12/27/smb-cifs-on-freebsd/
I followed to almost the very letter and the biggest issue I'm having right now, after rebooting my system over and over again, the Windows clients are not able to see the system; even after putting in the IP address. 


```
[global]
workgroup = WORKGOUP
netbios name = albert
server string = samba
security = user
encrypt passwords = yes
max log size = 500
preferred master = yes
interfaces = em0
bind interfaces only = yes
socket options = TCP_NODELAY
strict locking = no
strict sync = no

[homes]
comment = User Home
browseable = no
writeable = yes
directory mask = 0700
create mask = 0700

[etc]
comment = Server Configuration
path = /etc
public = no
writeable = yes
write list = @admin
directory mask = 0770
create mask = 0770

[www]
comment = Web Root
path = /usr/local/www
public = no
writeable = yes
write list = @webadm
directory mask = 0775
create mask = 0775

[TV]
path = /media/TV-Series
valid users = shares
public = no
writable = yes
browsable = yes
guest ok = no
create mask = 0755
directory mask = 0755

[Movies]
path = /media/Movies
vaid users = shares
public = no
writable = yes
browsable = yes
guest ok = no
create mask = 0755
directory mask = 0755
```

This is my rc.conf

```
hostname="ALBERT"
ifconfig_re0="inet 192.168.1.10 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
sshd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
linux_enable="YES"
kld_list="nvidia-modeset"
hald_enable="YES"
dbus_enable="YES"
samba_server_enable="YES"
```

What am I missing?


----------



## SirDice (Jul 26, 2022)

knightjp said:


> What am I missing?


Windows stopped using NetBIOS for its "Network neighborhood" a long time ago. It uses WS-Discovery nowadays. Install and enable net/py-wsdd, that will provide the necessary network discovery. No need to configure anything for it, just install and enable the service.

Also, don't forget to create user accounts with pdbedit(8).


----------



## knightjp (Jul 26, 2022)

SirDice thanks for the info. I tried it.. Didn't work. I installed 'net/py-wsdd" and rebooted the system after editing the "/etc/rc.conf" 
Everything is still the same. Not working.

Have to say, its rather annoying trying to figure this out; especially when I've done everything correctly.


----------



## cmoerz (Jul 26, 2022)

Maybe you've done this already, but since you didn't mention it - did you check the basic network connectivity between the hosts first?

I.e. can you ping the samba host from your windows host?

Is samba really running, i.e. do you see the ports correctly bound in `sockstat -4l`? Does anything of interest show in the samba logs?


----------



## msplsh (Jul 26, 2022)

cmoerz said:


> can you ping the samba host from your windows host?




So you're saying Start, Run (Windows-R) and then \\192.168.1.10 does nothing?


----------



## knightjp (Jul 26, 2022)

cmoerz said:


> Is samba really running, i.e. do you see the ports correctly bound in `sockstat -4l`? Does anything of interest show in the samba logs?


This is what my sockstat says. I've done everything to get samba running. I've done everything I could think of. Even rebooting the system. So what is the deal?


----------



## knightjp (Jul 26, 2022)

msplsh said:


> So you're saying Start, Run (Windows-R) and then \\192.168.1.10 does nothing?


I get an error, "Windows cannot locate \\192.168.1.10". It tells me to check the spelling of the name. 
I ping the BSD system from the Windows command prompt and I get a reply. So that's OK. 
The BSD system is actively having an internet connection. So all is good there. I'm writing this reply on it right now. I just don't understand what is the issue?


----------



## cmoerz (Jul 26, 2022)

You seem to be facing some issue with samba. You're missing a `smbd` process on port 445 IMHO. Can't say why though.
Sorry for repeating myself here: you'll have to check the logs. 
I recommend increasing log level to debug.


----------



## msplsh (Jul 26, 2022)

smbd isn't bound to anything.  That's a problem.


----------



## knightjp (Jul 26, 2022)

msplsh said:


> smbd isn't bound to anything.  That's a problem.


OK.. what am I missing? How do I bind it?


----------



## msplsh (Jul 26, 2022)

It binds itself.  There's an error starting up samba and you need to check your logs like cmoerz suggested in order to find it.


----------



## knightjp (Jul 26, 2022)

msplsh said:


> It binds itself.  There's an error starting up samba and you need to check your logs like cmoerz suggested in order to find it.


Sorry.. I'm new to FreeBSD.. all this talk about logs and stuff is over my head.. How do I check my logs?
I found this thread. https://forums.freebsd.org/threads/why-smbd-not-running-on-freebsd-13.79996/

It seems something is preventing smbd from running.. I just can't figure out what..


----------



## knightjp (Jul 26, 2022)

I just checked this.. 
/var/log/samba/log.smbd


```
[2022/07/26 23:12:21.269562,  0] ../../lib/param/loadparm.c:801(lpcfg_map_parameter)
  Unknown parameter encountered: "vaid users"
[2022/07/26 23:12:21.269745,  0] ../../lib/param/loadparm.c:1874(lpcfg_do_service_parameter)
  Ignoring unknown parameter "vaid users"
[2022/07/26 23:12:21.271318,  0] ../../source3/lib/interface.c:669(load_interfaces)
  WARNING: no network interfaces found
[2022/07/26 23:12:21.576520,  0] ../../lib/util/become_daemon.c:136(daemon_ready)
  daemon_ready: daemon 'smbd' finished starting up and ready to serve connections
[2022/07/26 23:12:21.586636,  0] ../../source3/smbd/server.c:1243(open_sockets_smbd)
  open_sockets_smbd: No sockets available to bind to.
[2022/07/26 23:12:21.587681,  0] ../../source3/lib/util.c:830(smb_panic_s3)
  PANIC (pid 1529): open_sockets_smbd() failed
[2022/07/26 23:12:21.588076,  0] ../../lib/util/fault.c:222(log_stack_trace)
  BACKTRACE:
   #0 log_stack_trace + 0x35 [ip=0x8010df5d5] [sp=0x7fffffffdea0]
   #1 smb_panic_s3 + 0x56 [ip=0x80173f5a6] [sp=0x7fffffffe770]
   #2 smb_panic + 0x17 [ip=0x8010df3c7] [sp=0x7fffffffe790]
   #3 smbd_exit_server + 0x3d5 [ip=0x8013e7375] [sp=0x7fffffffe7a0]
   #4 smbd_exit_server + 0x11 [ip=0x8013e6fb1] [sp=0x7fffffffe7f0]
   #5 <unknown symbol> [ip=0x8021cdbfc] [sp=0x7fffffffe800]
   #6 main + 0x1e9a [ip=0x1031a8a] [sp=0x7fffffffe810]
   #7 _start + 0xe2 [ip=0x102d3e2] [sp=0x7fffffffebf0]
   #8 <unknown symbol> [ip=0x80105b008] [sp=0x7fffffffec00]
[2022/07/26 23:12:21.736031,  0] ../../source3/lib/dumpcore.c:310(dump_core)
  unable to change to %N.core
  refusing to dump core
[2022/07/26 23:23:33.424556,  0] ../../lib/param/loadparm.c:801(lpcfg_map_parameter)
  Unknown parameter encountered: "vaid users"
[2022/07/26 23:23:33.424743,  0] ../../lib/param/loadparm.c:1874(lpcfg_do_service_parameter)
  Ignoring unknown parameter "vaid users"
[2022/07/26 23:23:33.426362,  0] ../../source3/lib/interface.c:669(load_interfaces)
  WARNING: no network interfaces found
[2022/07/26 23:23:33.796138,  0] ../../lib/util/become_daemon.c:136(daemon_ready)
  daemon_ready: daemon 'smbd' finished starting up and ready to serve connections
[2022/07/26 23:23:33.807881,  0] ../../source3/smbd/server.c:1243(open_sockets_smbd)
  open_sockets_smbd: No sockets available to bind to.
[2022/07/26 23:23:33.810029,  0] ../../source3/lib/util.c:830(smb_panic_s3)
  PANIC (pid 1623): open_sockets_smbd() failed
[2022/07/26 23:23:33.810840,  0] ../../lib/util/fault.c:222(log_stack_trace)
  BACKTRACE:
   #0 log_stack_trace + 0x35 [ip=0x8010df5d5] [sp=0x7fffffffd900]
   #1 smb_panic_s3 + 0x56 [ip=0x80173f5a6] [sp=0x7fffffffe1d0]
   #2 smb_panic + 0x17 [ip=0x8010df3c7] [sp=0x7fffffffe1f0]
   #3 smbd_exit_server + 0x3d5 [ip=0x8013e7375] [sp=0x7fffffffe200]
   #4 smbd_exit_server + 0x11 [ip=0x8013e6fb1] [sp=0x7fffffffe250]
   #5 <unknown symbol> [ip=0x8021cdbfc] [sp=0x7fffffffe260]
   #6 main + 0x1e9a [ip=0x1031a8a] [sp=0x7fffffffe270]
   #7 _start + 0xe2 [ip=0x102d3e2] [sp=0x7fffffffe650]
   #8 <unknown symbol> [ip=0x80105b008] [sp=0x7fffffffe660]
[2022/07/26 23:23:33.978251,  0] ../../source3/lib/dumpcore.c:310(dump_core)
  unable to change to %N.core
  refusing to dump core
```
Anything here to tell us why it is not working?


----------



## msplsh (Jul 26, 2022)

knightjp said:


> bind interfaces only = yes


Take this out and see if it works.


----------



## anlashok (Jul 26, 2022)

I note that in the samba config you are telling samba to use network interface em0 

```
preferred master = yes
interfaces = em0
bind interfaces only = yes
```
however in the rc.conf section your network interface is listed as being re0, so one of those is probably wrong

```
ifconfig_re0="inet 192.168.1.10 netmask 255.255.255.0"
```

fix the spelling of "valid users" in [Movies] block of the samba config to fix this

```
Unknown parameter encountered: "vaid users"
```


----------



## msplsh (Jul 26, 2022)

Can leave "bind interfaces only" if you make the "interfaces" and ifconfig_xx0 match.  Didn't jump out at me before.


----------



## knightjp (Jul 27, 2022)

Thanks anlashok & msplsh.. Being a complete newbie, I followed the blog post a little bit too much "to the letter" and didn't notice the differences. 
After changing this line, 
`interfaces = em0` to `interfaces = re0`, it just started working. I changed the line, rebooted the system and checked the status of smbd.. it was running and everything started working.


----------



## SirDice (Jul 27, 2022)

You can disable nmbd (runs on ports 137, 139), it's for pre-Windows 2000 versions of Windows. Modern Windows' SMB file sharing works on port 445 exclusively. 


```
samba_server_enable="YES"
nmbd_enable="NO"
```


----------

