Samba Installation on BSD

✅ Final Working Samba + NTFS Setup Guide (GhostBSD)

1. Create the Samba User

sudo adduser nasuser

Verify:
id nasuser
getent passwd nasuser

2. Set Samba Password

sudo smbpasswd -a nasuser
sudo smbpasswd -e nasuser

Verify:
sudo pdbedit -L

3. Mount the NTFS Drive (Manual Test First)

sudo mkdir -p /mnt/20tb
sudo ntfs-3g -o allow_other,default_permissions,uid=1002,gid=1002,windows_names,rw /dev/da0p1 /mnt/20tb

Verify:
mount | grep 20tb
ls -ld /mnt/20tb
su - nasuser -c "ls /mnt/20tb" | head -5

4. Auto-Mount on Boot (Add to fstab)

File: /etc/fstab

Add this line:
/dev/da0p1 /mnt/20tb ntfs-3g rw,allow_other,default_permissions,uid=1002,gid=1002,windows_names,big_writes 0 0

Verify & Apply:
sudo umount -f /mnt/20tb
sudo mount /mnt/20tb
mount | grep 20tb

5. Samba Configuration

File: /usr/local/etc/smb4.conf

[global]
   workgroup = WORKGROUP
   server string = NAS-T15
   netbios name = NAS-T15
   security = user
   map to guest = Bad User
   guest account = nobody
   log level = 2

[20tb]
   path = /mnt/20tb
   browsable = yes
   writable = yes
   guest ok = no
   read only = no
   create mask = 0666
   directory mask = 0777
   valid users = nasuser
   force user = nasuser
   force group = nasuser
   nt acl support = no
   ea support = no

Verify:
sudo testparm

6. Services + Firewall (rc.conf)

File: /etc/rc.conf

Add these lines:
samba_server_enable="YES"
firewall_enable="YES"
firewall_type="workstation"
firewall_myservices="80/tcp 22/tcp 139/tcp 445/tcp 137/udp 138/udp"
firewall_allowservices="any"

Verify:
grep -E 'samba|firewall' /etc/rc.conf

7. Start Everything

sudo service ipfw restart
sudo service samba_server restart

Verify:
sudo ipfw list
service samba_server status
sockstat -4l | grep -E '445|139'

8. Final Tests

Local test:
smbclient -L localhost -U nasuser
smbclient //localhost/20tb -U nasuser (then type ls)

Windows test:
net use * /delete /yes
Map: \\192.168.1.250\20tb