Setting up a public share with Samba

Sometimes you just want to quickly set up Samba with a public share – no authentication, world writable.

To install Samba on Debian:

apt-get install samba

Having Samba installed, just replace the contents of /etc/samba/smb.conf with the following configuration:

   workgroup = WORKGROUP
   server string = %h server (Samba, Debian)
   dns proxy = no
   log file = /var/log/samba/log.%m
   max log size = 1000
   syslog = 0
   panic action = /usr/share/samba/panic-action %d
   security = share
   encrypt passwords = true
   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
   guest account = nobody
   load printers = no
   usershare allow guests = yes

path = /share
browsable = yes
writable = yes
read only = no
guest only = yes
create mask = 0644
directory mask = 0755

Finally restart Samba:

/etc/init.d/samba restart

This works great on Debian, but should work also on other distributions!