Ubuntu 14.04 - Set Up A Public 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
guest account = $USER
[my_shared_folder]
public = yes
path = /code
browsable = yes
writable = yes
guest ok = yes
read only = no
create mask = 0755" | sudo tee /etc/samba/smb.conf
sudo service smbd restart
echo "Your SAMBA share is now set up."
Debugging
If you experience issues, you may find it useful to run the testparm
command. This will tell you if there are any issues with your samba configuration.
References
- How to install Samba server on Ubuntu 12.04
- ServerFault - How do I force specific permissions for new files/folders on Linux file server?
- Ask Ubuntu - I cant get samba to set proper permissions on created directories
- Configure permissions and ownership for Samba on Linux
- How-To Geek - Create a Samba User on Ubuntu
- NixCraft - Test your Samba server for configuration errors
Last updated: 11th January 2025
First published: 16th August 2018
First published: 16th August 2018