Swizzling.org

Welcome to swizzling kids. The site with no real purpose and shocking low levels of content.

Simple NAS box with samba

November 26th, 2009 . by Dave
Here's a sample /etc/smb.conf I use when I need to deploy a nice simple NAS box.
Start a nice simple distro, I like CentOS myself.
Install samba
# yum install samba

Create a new system user and set a password. This user is used for ownership and permissions of the shares presented by Samba.
# useradd nas-user
# passwd nas-user

Create a samba password for the new user
# smbpasswd -a nas-user

Create a directory somewhere for storage of files used by the samba share
# mkdir /storage1

Change ownership for the new directory to the new user. All files for the share will be owned by this user.
# chown nas-user:nas-user /storage1

Now edit /etc/samba/smb.conf

[global]
	workgroup = Sales-Department
	server string = "Some comment, visible only from network browser in Windows"
	netbios name = FileServer

	# Disable printers and faxes
	load printers = no
	disable spoolss = yes
	printcap name = /dev/null

	# Only allow connections from 192.168.1.0 subnet. Deny everything else
	hosts allow = 192.168.1.0/24
	hosts deny = 0.0.0.0/0

	security = user
	passdb backend = tdbsam

[backups-storage]
	comment = Storage for backups and archives
	path = /storage0
	force user = backups-user
	force group = backups-user
	read only = No
	guest ok = Yes

Now restart the samba service.
# service smb restart