How I got Samba4 working for me

Simple SMB on home network. I decided to figure this out when I wasn't able to play most games from USB stick on my Sony PlayStation2. SMB was the answer and my Linksys EA8500v1 is the only device I own with a USB3.0 port for the drive. PS2 is USB1.0 so yeeeaaahhhh had to fix that.

I'm getting 90MB/s on gig net and the PS2 loads faster than media.

It's not meant to be hardened it's just functional enough for my needs in my own little world.
All that said I present to you my Samba4WRT setup.

CHANGE THE FOLLOWING VALUES
SMBUSER SMBPASS SMBPASS2 SMBGROUP SHARE SHARENAME

First install these packages via uci or Luci
block-mount
kmod-usb-storage
kmod-fs-ext4
libext2fs2
luci-app-samba4
mount-utils
samba4-admin
samba4-client
samba4-libs
samba4-server
samba4-utils

Add the USB device by following this.
DO NOT PERFORM STEP 7!!!!!
DONT FSTAB ORMOUNT LUCI DOES THAT
STOP AT STEP SIX STOP AT STEP SIX DO NOT PERFORM STEP 7!!!!!
usb-drives-quickstart
STOP AT STEP SIX STOP AT STEP SIX DO NOT PERFORM STEP 7!!!!!

Luci>System>Mount Points>Mount Points

Add UUID device leave path empty
auto generate config, enable, save
(may need to enable again after 1st save)

SSH>

Add a new system user,system group and Samba user
Edit the following files:
/etc/passwd: SMBUSER:x:1000:1000:SMBGROUP:/mnt/sda1/SHARE/:/bin/false
/etc/group: SMBGROUP:x:1000:
/etc/shadow: SMBUSER:xyzDummyString:16666:0:99999:7:::
Change password
passwd SMBUSER

Create samba user and password
smbpasswd -a SMBUSER SMBPASS2 (these will be the login credentials)

Create share directory in for new Mount Point location SHARE
mkdir -p /mnt/sda1/SHARE

Group and user chown
chgrp -R SMBGROUP /mnt/sda1/SHARE/
chmod 2777 /mnt/sda1/SHARE/

Luci>System>Mount Points/Mount Points
Select UUID edit
custom /mnt/sda1/SHARE/ <- dont forget the wack!!

Luci>Services>Network Shares>EditTemplate
Replace all with the following:

[global]
	netbios name = |NAME| 
	interfaces = |INTERFACES|
	server string = |DESCRIPTION|
	unix charset = |CHARSET|
	workgroup = |WORKGROUP|

	bind interfaces only = yes

	deadtime = 15

	enable core files = no
	security = user
	invalid users = root
        map to guest = never

	passdb backend = smbpasswd

	socket options = IPTOS_LOWDELAY TCP_NODELAY

	load printers = No
	printcap name = /dev/null
	disable spoolss = yes
	printing = bsd

	mdns name = mdns
	disable netbios = yes
	local master = yes
	preferred master = yes

	veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/
	delete veto files = yes

	fstype = Samba

       max protocol = SMB2 
       min protocol = SMB2

Luci>Network Shares>General Settings>General Settings
Check boxes default

Luci>Network Shares>General Settings>Shared Directories
Add
!!FALSE on all but browsable!!
Name:SHARENAME
PATH: /mnt/sda1/SHARE/
Browseable=TRUE
AllowedUser:SMBUSER
0777
0777
!!FALSE on all but browsable!!!

SSH>

Verify /etc/config/samba4

config samba
	option workgroup 'WORKGROUP'
	option charset 'UTF-8'
	option description 'Samba on OpenWRT'

config sambashare
	option name 'SHARENAME'
	option guest_ok 'no'
	option dir_mask '0777'
	option read_only 'no'
	option path '/mnt/sda1/SHARE/'
	option create_mask '0777'
	option users 'SMBUSER'

Local SMB client test
smbclient -U SMBUSER //IP/SHARE/ <- dont forget the wack!!

Windows will require SMBUSER and SMBPASS to connect, click Sign in with different credentials

I'll update If I forgot something.
Stay Healthy!

Thanks for the guide with user management, just some extra notes.

These are netbios options and can be omitted and leave at defaults

local master = yes
preferred master = yes

To just run the server only samba4-server is needed, which includes the smbpasswd tool.

If you want to browse your shares via windows explorer also install the wsdd2 package.

PS: You can verify your smb.conf via the testparm tool also included in the server package. This compares your changes against the defaults and prints only actual changes.

1 Like

Hi,

I did exactly all of this, but I'm getting this error message:

image

And it got me as far as I could. Can the problem be that I'm using windows 8.1?

I also get this on explorer:

Can someone help please?