Samba

Installation

From terminal,

sudo apt-get install samba

Reset

If you can't connect to the pi samba drives from your PC, you should reset samba on the pi.

sudo service smbd restart

Config file

You need to edit the samba config file to get access to the specific directories you want to be available.

sudo nano /etc/samba/smb.conf

Add at top

## Browsing/Identification ###

netbios name = pi-NameYouWant


Change

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


[homes]

comment = Home Directories

browseable = no


# By default, the home directories are exported read-only. Change the

# next parameter to 'no' if you want to be able to write to them.

read only = no


# File creation mask is set to 0700 for security reasons. If you want to

# create files with group=rw permissions, set next parameter to 0775.

create mask = 0775


# Directory creation mask is set to 0700 for security reasons. If you want to

# create dirs. with group=rw permissions, set next parameter to 0775.

directory mask = 0775


#Add at bottom. This section lets you edit the samba config file .


[SAMBA CONFIG]

path = /etc/samba/

comment = No comment

browsable = yes

read only = no

valid users =

writable = yes

guest ok = yes

public = yes

create mask = 0777

directory mask = 0777

force user = root

force create mode = 0777

force directory mode = 0777

hosts allow =


#This section lets you access and edit the IOTstack files.


[IOTstack]

path = /home/pi/IOTstack

comment = No comment

browsable = yes

read only = no

valid users =

writable = yes

guest ok = yes

public = yes

create mask = 0777

directory mask = 0777

force user = root

force create mode = 0777

force directory mode = 0777

hosts allow =



#This section lets you access and edit the home assistant files


[HA Docker]

path = /home/pi/IOTstack/volumes/home_assistant

comment = No comment

browsable = yes

read only = no

valid users =

writable = yes

guest ok = yes

public = yes

create mask = 0777

directory mask = 0777

force user = root

force create mode = 0777

force directory mode = 0777

hosts allow =

#This section lets you access and edit the externally mounted USB stick

[USB Stick]
path = /mnt/usbstick

comment = No comment

browsable = yes

read only = no

valid users =

writable = yes

guest ok = yes

public = yes

create mask = 0777

directory mask = 0777

force user = root

force create mode = 0777

force directory mode = 0777

hosts allow =


Setup

Add password for user pi

sudo smbpasswd -a pi

And enter a password for samba, username = pi

sudo service smbd restart

Go to different PC, find netbios name you gave in Samba, open with user = pi and PW from above step


Asus router NAS

Old Info (mostly for Netgear router)

Asus router

Go to USB Application on left, then Network Place (Samba) Share / Cloud Disk on top

Enable share

I gave it a device name of rt-86u. This is used in mount statements

Media Server on top

I added my directories with media here to make them accessable.

There is a directory called 2gb on the drive I want to share

I tested in browser to make sure I could get to

smb://rt-86u/2gb


Now make directory in pi

cd /mnt

sudo mkdir rt-86u

cd /mnt/rt-86u

Mount the drive now, manually

sudo mount -t cifs //rt-86u/2gb /mnt/rt-86u -o guest,vers="1.0"

Check to see if drive mounted

cd ..

ls rt-86u

If it didn't work, you could try this version. Above worked for me

sudo mount -t cifs //rt-86u/2gb /mnt/rt-86u -o guest,vers="1.0",sec=ntlmv2


To make it work permanently, you need to edit fstab

cd /etc

sudo nano fstab


//rt-86u/2gb /mnt/rt-86u cifs guest,x-systemd.automount,x-systemd.device-timeout=60,vers=1.0 0 0

Test

sudo reboot