Ubuntu 14.04 - Set Up A Samba Share

To install a public samba share in ubuntu, write this script to your ubuntu machine, edit the two settings files at the top, and run it as root (sudo su)

#!/bin/bash
# Author: Programster
# website: http://programster.blogspot.co.uk/


# Set the windows home group. On windows this defaults to WORKGROUP but you may
# have set up a custom home group name, in which case change it here.
HOME_GROUP="WORKGROUP"


# Define the folder that you want to make publicly shareable with everyone here.
# Please make sure to specify the FULL path (not relative)
PUBLIC_FOLDER='/var/www'

# Define who the owner and group should be 
# for any files that are created
USER="programster"
GROUP="www-data"

############################ END OF SETTINGS ###################################



sudo apt-get update
sudo apt-get install samba samba-common -y
sudo apt-get install python-glade2 system-config-samba -y

echo "[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = ubuntu
security = user
map to guest = bad user
dns proxy = no
force user = $USER
force group = $GROUP

[keith_code]
public = yes
path = /code
browsable = yes
writable = yes
guest ok = yes
guest account = $USER
read only = no
create mask = 0755" | sudo tee /etc/samba/smb.conf

sudo service smbd restart
echo "Your SAMBA share is now set up."

References

Author

Programster

Stuart is a software developer with a passion for Linux and open source projects.

comments powered by Disqus
We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites. More info.