# Samba server and Windows 11



## adnanml (Jul 12, 2022)

Hello,

I'm new in FreeBSD and I'm trying to set up a Samba server and access it via Windows 11. I have a VMware FreeBSD 13 machine, and I have already installed the Samba 413. I did a lot of research and reading but could not find a solution. When I do: "service samba_server status" I get:
nmbd is running as pid: xxx
smbd is running as pid: xxx
winbindd is running as pid: xxx

The running of "testparam" is also Ok, and I don't see any problems.
I can see the FreeBSD Machine in my Network (from Windows 11), but when I double click or try "Map network drive..." I cannot access it. I'm doing something wrong, but I cannot figure out what. A helping hand would be great if you had some experience with FreeBSD and Samba.

Ps: I was able to do this in Ubuntu and access the files and the folder without any problem using Samba. But in FreeBSD I'm stuck, or have hit a wall 






I doesn't matter at the moment if you use "Map network drive..." (just IP \ or IP \media\samba) or just double click on \\FREEBSD, it's always a network error.




The folder that I'm trying to access via my windows 11 as root.

My smb4.conf is:

```
[global]
     workgroup = WORKGROUP
     server string = %h server (Samba)
     log file = /var/log/samba4/log.%m
     max log size = 1000
     logging = file
     panic action = /usr/share/samba/panic-action %d
     server role = standalone server
     obey pam restrictions = yes
     unix password sync = yes
     passwd program = /usr/bin/passwd %u
     passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
     pam password change = yes
     map to guest = bad user

[printers]
     comment = All Printers
     browseable = no
     path = /var/spool/samba
     printable = yes
     guest ok = no
     read only = yes
     create mask = 0700

[print$]
     comment = Printer Drivers
     path = /var/lib/samba/printers
     browseable = yes
     read only = yes
     guest ok = no

[Samba]
     comment = Samba Share
     path = /media/samba
     read only = no
     browsable = yes
     writeable = yes
     valid users = root
```
I don't know why, but somehow I'm missing something, and it's not working.
Any help, suggestion is appreciated.

Many thanks in advance.
Adnan


----------



## zsolt (Jul 12, 2022)

You have to add a user account with pdbedit and then you can try to delete the entry of samba server in Windows Credentials and try again.


----------



## adnanml (Jul 13, 2022)

zsolt said:


> You have to add a user account with pdbedit and then you can try to delete the entry of samba server in Windows Credentials and try again.


I did that, and also restarted both machines hopping that the restart will delete the entry of the samba server in the Win Credentials. I also checked if any Win Credential related to samba server via "rundll32.exe keymgr.dll KRShowKeyMgr" and nothing found. I still cannot access the samba server via Win.

I modified the last part of the smb4.conf file to:

```
[samba]
     comment = Samba Share
     path = /home/adnan/samba
     read only = no
     browsable = yes
     writeable = yes
     valid users = adnan
```
... and when I do a ls -la for folder /home/adnan I see:

```
drwxr-xr-r 2 adnan adnan 2 Jul 11 14:31 samba
```

But it didn't help so far. It shows when restarting my FREEBSD VM machine: Samba name server FREEBSD is now a local master browser for workgroup WORKGROUP on subnet 192.1xx.1xx.xx9 (FreeBSD VM ip address). Don't know if this helps.


----------



## amilis (Jul 14, 2022)

On my SMB servers I don’t use `unix password sync, passwd program, passwd chat, pam password change`. 

Here is a really simple configs that works on windows. 


```
[global]
workgroup          = NAME
netbios name       = NAME
server string      = NAME
security           = user
max smbd processes = 20
encrypt passwords  = yes
socket options     = TCP_NODELAY IPTOS_LOWDELAY IPTOS_THROUGHPUT SO_KEEPALIVE SO_RCVBUF=65536 SO_SNDBUF=65536
aio read size      = 16384
aio write size     = 16384
strict locking     = no
strict sync        = no

# DISABLE PRINTING
load printers           = no
disable spoolss         = yes
show add printer wizard = no

[backup1]
  path       = /PATH
  public     = no
  writable   = yes
  browsable  = yes
  write list = USER1, USER2, USER3
```

USER1, USER2, USER3 is the windows users. 
Run for every user. 


```
# pdbedit -a -u USER1
# pdbedit -a -u USER2
# pdbedit -a -u USER3
```

Restart the SMB and it should work! 
P.S. The samba servers is on a closed/secured local network


----------



## zsolt (Jul 14, 2022)

Try to put in explorer window: \\IP_ADRESS\Samba and hit Enter. You should receive a window where you have to put the credentials, I think of root.


----------



## amilis (Jul 15, 2022)

I my config you specify the users (or group with @groupname) in the `write list = USER1, USER2, USER3` row and set the userpassword with `pdbedit -a -u USER1`. Then It’s just to restart the sambaserver with `service samba_server restart`. 

But for that to work, you properly would need to change you [global] config as you have PAM login etc. there. My [global] works with Windows, OSX, *nix and *BSD. 

And yes, you will get a login user/pass window when you put in the IP (no need for the path on Windows/OSX) in files/explorer. About you root, you should’t use `valid users = root`.


----------



## adnanml (Jul 19, 2022)

I thank you all for the valuable inputs and information. Good news is I managed to get it working. The main big problem was with the IP addresses that I had. While I tried this in Ubuntu VMware machine, it worked without any problem. In Ubuntu I had Network Adapter set to NAT (Used to share the host's IP address). And the IP address I was getting was:

VMware Ubuntu : 192.168.1xx.aaa
In my Win 10 PC : 192.168.2yy.bbb

This did make a problem in VMware Ubuntu. It just work.

While in FreeBSD via VMware or VirtualBox this doesn't worked. Having the Network Adapter to NAT was the reason that I could not access the Samba folder. Was getting the same IP settings:

VMware Ubuntu : 192.168.1xx.ccc
In my Win 10 PC : 192.168.2yy.bbb

and was not working. Then I changed the Network Adapter to Bridged (Connected directly to the physical network) and selected the network adapter I have on my PC (Qualcomm Atheros WNA).

My new FreeBSD VMware IP is : 192.168.2yy.mm and after this it was all to easy.

Thank you again for your feedback.


----------

