[Tutorial] Samba Configuration

Raspberry Pi related support

[Tutorial] Samba Configuration

Postby rern » 20 Jul 2017, 12:36

[Tutorial] Samba Configuration
Tested on RuneAudio beta-20160313
View code - GitHub

Server name
Any os file browsers - Set Host name in Settings menu
Only Windows(NetBIOS) file browsers - Edit netbios name in /etc/samba-dev/smb.conf

Configuration
/etc/samba/smb-dev.conf
Code: Select all
[global]
#   netbios name = [name]
   workgroup = WORKGROUP
   server string = Samba %v on %L
   
   wins support = yes
   domain master = yes
   preferred master = yes
   local master = yes
   os level = 255   
   dns proxy = no
   log level = 0

   socket options = IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072
   min receivefile size = 2048
   use sendfile = yes
   aio read size = 2048
   aio write size = 2048
   write cache size = 1024000
   read raw = yes
   write raw = yes
   getwd cache = yes
   oplocks = yes
   max xmit = 32768
   dead time = 15
   large readwrite = yes

   guest ok = yes
   map to guest = bad user
   encrypt passwords = yes

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

[readwrite]
   comment = browseable, read, write, guess ok, no password
   path = /mnt/MPD/USB/hdd/readwrite
   read only = no
[read]
   comment = browseable, read only, guess ok, no password
   path = /mnt/MPD/USB/hdd/read
[root]
   comment = hidden, read, write, root with password only, from [IP1] [IP2] only
   path = /mnt/MPD/USB/root
   browseable = no
   read only = no
   guest ok = no
   valid users = root
#   host allow = [IP1] [IP2]


Test smb.conf parameters
Code: Select all
testparm


Fix minimum rlimit_max
Code: Select all
echo -n '
root    soft    nofile    16384
root    hard    nofile    16384
' >> /etc/security/limits.conf

Close SSH and reconnect to update new value.

Restart
Code: Select all
systemctl restart nmbd smbd


Upgrade
    - RuneAudio already installed samba4-rune
    - Upgrading to latest Samba with following configuration should improve transfer speed by 30%, from 8MB/s up to 11MB/s, on wired network
    - RuneAudio has trouble with system wide upgrade. Do not pacman -Syu

Stop Samba
Code: Select all
systemctl stop nmbd smbd


Fix packages download errors
Code: Select all
if  grep '^Server = http://mirror.archlinuxarm.org/' /etc/pacman.d/mirrorlist; then
   wget -qN --show-progress https://github.com/rern/RuneAudio/raw/master/rankmirrors/rankmirrors.sh
   chmod +x rankmirrors.sh
   ./rankmirrors.sh
fi
pacman -Sy


Remove Existing - Install Latest Samba
Code: Select all
pacman -R --noconfirm samba4-rune
pacman -S --noconfirm tdb tevent smbclient samba
# fix missing libreplace-samba4.so
pacman -S --noconfirm libwbclient

ln -sf /etc/samba/smb-dev.conf /etc/samba/smb.conf


Restart
Code: Select all
systemctl daemon-reload
systemctl restart nmbd smbd


Remarks: Do it the easy way with Addons Menu
Last edited by rern on 15 Oct 2017, 13:45, edited 1 time in total.
rAudio @ https://github.com/rern/rAudio-1
Raspberry Pi 4B
Raspberry Pi 3B > SMSL M8 DAC
Raspberry Pi Zero W
User avatar
rern
 
Posts: 723
Joined: 14 Jul 2016, 08:15

Re: [Tutorial] Samba Configuration

Postby johnberg » 31 Jul 2017, 22:12

Dear Rern,

I have a raspberry pi B with v0.3-beta (29/10/2014).

How do I config all those text files, do I need wordpad or a Linux editor for this.
Maybe only need Putty?
I am completely green with Linux and don't know where to begin.

I would be very glad if samba was working.

Please can you give me some step by step explanation to edit this textfiles and where I can find them with which app or editor.

I think it is not so difficult, but I need to know where to begin.

Thanks a lot :?
johnberg
 
Posts: 16
Joined: 27 Oct 2016, 20:10

Re: [Tutorial] Samba Configuration

Postby hondagx35 » 31 Jul 2017, 22:49

Hi johnberg,

- Get access to the console:
Use SSH from your PC
    If you are not familiar with SSH read this for Windows or this for Linux/MacOS
    The default login for RuneAudio is "root" with the password "rune" (without quotes).

- Use sftp to access files on Rune Audio:
Get WinSCP from here and install it.
When it opens setup the following:
- Session
File Protocol: SCP
Host name: The IP address of you Raspberry Pi
User name: root
Password: rune

That's it, connect and you can transfer files just by dragging and dropping.

Frank
User avatar
hondagx35
 
Posts: 3042
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: [Tutorial] Samba Configuration

Postby johnberg » 01 Aug 2017, 21:56

Thank you Frank,
I did install winscp portable

This is my etc/samba/smb-dev.conf -file on Raspberry Pi B now:

[global]

workgroup = RUNENET
server string = RuneAudio Player
dns proxy = no
log level = 0
syslog = 0
security = share
guest account = root
map to guest = bad user
load printers = no
domain master = no
local master = no
preferred master = no


#======================= Share Definitions =======================

directory mask = 0775
create mask = 0775

[music_store]
comment = Music Datastore root (/mnt/MPD)
path = /mnt/MPD/
read only = no
public = yes
follow symlinks = yes
wide links = yes

[mpd]
comment = MPD directory (/var/lib/mpd/)
path = /var/lib/mpd/
read only = no
public = yes
follow symlinks = yes
wide links = yes

[www]
comment = RuneAudio webroot (/var/www/)
path = /var/www/
read only = no
public = yes
follow symlinks = yes
wide links = yes

[etc]
comment = RuneAudio sys config dir (/etc)
path = /etc/
read only = no
public = yes
follow symlinks = yes
wide links = yes

Do I have to delete this text now and replace completely for:

[global]
# netbios name = [name]
workgroup = WORKGROUP
server string = Samba %v on %L

wins support = yes
domain master = yes
preferred master = yes
local master = yes
os level = 255
dns proxy = no
log level = 0

socket options = IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072
min receivefile size = 2048
use sendfile = yes
aio read size = 2048
aio write size = 2048
write cache size = 1024000
read raw = yes
write raw = yes
getwd cache = yes
oplocks = yes
max xmit = 32768
dead time = 15
large readwrite = yes

guest ok = yes
map to guest = bad user
encrypt passwords = yes

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

[readwrite]
comment = browseable, read, write, guess ok, no password
path = /mnt/MPD/USB/hdd/readwrite
read only = no
[read]
comment = browseable, read only, guess ok, no password
path = /mnt/MPD/USB/hdd/read
[root]
comment = hidden, read, write, root with password only, from [IP1] [IP2] only
path = /mnt/MPD/USB/root
browseable = no
read only = no
guest ok = no
valid users = root
# host allow = [IP1] [IP2]

What to type in [name] ????

The next three are this Putty commands?

Test smb.conf parameters

Fix minimum rlimit_max

Restart


Should samba work now after this 4 handlings?

By the way is this tutorial for Raspberry Pi 3 or for all versions?
I have an older Raspberry Pi B model (version sv0.3-beta (29/10/2014) should this also work with this script?
johnberg
 
Posts: 16
Joined: 27 Oct 2016, 20:10

Re: [Tutorial] Samba Configuration

Postby rern » 03 Aug 2017, 16:02

Code: Select all
#netbiosname = [name]

# - indicates "comment" : not used
To connect from Windows to Samba by name instead of IP, remove '#' and type a name without brackets. (I've just noticed it's confusing to use brackets here.)

Code: Select all
...
[readwrite]
...
path = /mnt/MPD/USB/hdd/readwrite
...

[readwrite] - shared name (type a name with brackets)
/mnt/MPD/USB/hdd/readwrite - directory to share as readwrite (must exists)
Do the same for [read], [root] and any other shares

Test smb.conf parameters
Fix minimum rlimit_max
Restart

These 3 blocks are command lines to paste/type in PuTTY.

Just try it.
At worst, Samba just refused to start if it's not right.
rAudio @ https://github.com/rern/rAudio-1
Raspberry Pi 4B
Raspberry Pi 3B > SMSL M8 DAC
Raspberry Pi Zero W
User avatar
rern
 
Posts: 723
Joined: 14 Jul 2016, 08:15

Re: [Tutorial] Samba Configuration

Postby johnberg » 03 Aug 2017, 22:18

Thanks Rern,

My smb-dev.conf page is looking completely different as yours (Pi B v0.3-beta)
Do I have to delete the complete text of this page and replace it for your version?

What to do with this??
...
[readwrite]
...
path = /mnt/MPD/USB/hdd/readwrite
...

The name of my hdd is "Elements"


Is it possible to keep it simply and leave the names away, if I get it working with a simply ip adress
(//192.168.0.100) I will be more then happy.
johnberg
 
Posts: 16
Joined: 27 Oct 2016, 20:10

Re: [Tutorial] Samba Configuration

Postby rern » 04 Aug 2017, 04:53

In WinSCP:

First make sure Samba is running, share directories are visible in Windows file explorer, then:

1. Verify the path of "Elements"
    Remote directory pane - double click:
      / > mnt > MPD > USB > Elements
    The path:
      path = /mnt/MPD/USB/Elements

2. Don't use the new smb-dev.conf just yet.
Add this to the end of the existing smb-dev.conf
Code: Select all
[Elements]
path = /mnt/MPD/USB/Elements
readonly = no


3. Wait for Samba to update configuration (every 60 seconds).
Or force update:
in PuTTY:
Code: Select all
systemctl restart smbd


4. The new share, Elements, will appear in Windows file explorer.

Try changing smb-dev.conf one line at a time to get some clues. Then you're good to go.
rAudio @ https://github.com/rern/rAudio-1
Raspberry Pi 4B
Raspberry Pi 3B > SMSL M8 DAC
Raspberry Pi Zero W
User avatar
rern
 
Posts: 723
Joined: 14 Jul 2016, 08:15

Re: [Tutorial] Samba Configuration

Postby johnberg » 05 Aug 2017, 10:58

rern wrote:
First make sure Samba is running, share directories are visible in Windows file explorer


I did do this by using this command in putty:

Code: Select all
systemctl enable smbd

After this command you don't get any message that is was succefull, little bit confusing.

All the time I tested it on Filebrowser on the Ipad and this make me lost my way because it needed a plaintext password??
And I did not get access to the Rune.

Then at last I tested it on my windows computer by typing \\192.168.0.100 in Internetexplorer
And then happened what I was looking for so long: I saw the files from Rune:
\\192.168.0.100\music_store\USB\Elements
Very happy :D
For the moment this is enough for me, now I can add coverart to my music and add new music without every time need to disconnect my harddisk.
Also Es File Explorer on my Andoid phone is working fine, so I can play all the music on a bluetooth speaker.
This is a nice extra option.
I don't understand what is wrong with Filebrowser on the ipad in the past it did work well with Volumio.

I think it is making connection but "plaintext password is requested"??? :shock:
But samba on Rune no need any password at all
Any idea to solve this?

@Rern
Thank you for helping me :)

I think the purpose of your configuration is to see Elements direct on the networkbrowser.
I think I also gonna try this, but for the moment I have everything I need.
Downloadspeed to my PC is ca. 6.5 MB/sec.
Am I right that you also can optimize this?
johnberg
 
Posts: 16
Joined: 27 Oct 2016, 20:10

support RuneAudio Donate with PayPal


Return to Raspberry Pi

Who is online

Users browsing this forum: Google [Bot] and 7 guests