Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Samba setup for Raspberry Pi Raspbian 8 (jessie)
# update package list
sudo apt-get update
# install samba
sudo apt-get install samba samba-common-bin
# to use hfs+ file-system
sudo apt-get install hfsprogs
# list mounted disks, usfull to umount
# df
# to auto mount external drive, add a new line to /etc/fstab
# Ex: /dev/sda3 /media/external-hd hfsplus rw,force,nofail 0 0
# create a backup version of the samba configuration file
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup
# setup config /etc/samba/smb.conf
# More info check the manuals:
# man samba
# man smb.conf
# create linux user
# Ex: adduser john
# create smd user
# Ex: sudo smbpasswd -U john
# restart samba server
sudo /etc/init.d/samba restart
# /etc/samba/smb.conf
# TODO more secure config
[global]
workgroup = WORKGROUP
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
server role = standalone server
passdb backend = tdbsam
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
usershare allow guests = yes
[homes]
comment = Home Directories
browseable = no
read only = no
create mask = 1777
directory mask = 1777
valid users = %S
path = /media/external-hd/users/%u
[shared]
comment = Shared directory
path = /media/external-hd/shared
browseable = yes
read only = no
guest ok = yes
create mask = 1777
directory mask = 1777
@TurnKeyMSP

This comment has been minimized.

Copy link

commented Sep 2, 2017

Didn't work for my setup (local domain, external HDD on /mnt/ext, home on /home/%u:

'

/etc/samba/smb.conf

TODO more secure config

[global]
workgroup = scafidi.org
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
server role = standalone server
passdb backend = tdbsam
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
usershare allow guests = yes
[homes]
comment = Home Directories
browseable = no
read only = no
create mask = 1777
directory mask = 1777
valid users = %S
path = /home/%u
[shared]
comment = Shared directory
path = /mnt/ext/
browseable = yes
read only = no
guest ok = yes
create mask = 1777
directory mask = 1777
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.