This brief tutorial shows students and new users how to create a public Samba shares on Ubuntu server so everyone can access without authenticating. This share will be fully accessible to all and everyone will be able create, modify and delete folders and files.
Then in our next post we’ll show you how to create restricted shares so only authenticated users can access.
For those who don’t know, Samba is a opensource implementation of Microsoft SMB/CIFS protocol. It provides fast and secure files and print services for clients using the SMB/CIFS protocol. Simply put, it provides files and printer sharing between clients and servers.
To get started with creating a public share that can be fully accessed by everyone, continue with the steps below:
Step 1: Install Samba
The first thing you’ll need to do is install Samba. To install it run the commands below.
sudo apt-get update sudo apt-get install samba
The commands above install Samba and all other dependencies.
Step 2: Create the Share
First, create the folder you want to share with the public. The folder can be anywhere but set its permission so that everyone can access it. For this this tutorial, our share will be /home/Public
Run the commands below to create the folder you wish to share.
sudo mkdir /home/Public
Then set the share permission so everyone has full access to it.
sudo chmod 0777 /home/Public sudo chown -R nobody:nogroup /home/Public
Step 3: Configure Samba
Now that Samba is installed, you must now configure it to provide file and print services to clients. This can be done by editing its default configurations file. First create a backup of the configuration file by running the commands below.
sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
Next, run the commands below to open/create a new configuration file.
sudo nano /etc/samba/smb.conf
Then add the content below into the file and save. Our share will be called Public as defined in the setting below [Public]
[global] workgroup = WORKGROUP server string = Samba Server %v netbios name = ubuntu security = user map to guest = bad user name resolve order = bcast host dns proxy = no bind interfaces only = yes # add to the end [Public] path = /home/Public writable = yes guest ok = yes guest only = yes read only = no create mode = 0777 directory mode = 0777 force user = nobody
Save the file and exit
now, in terminal run below commands to give permission to userhsare which is necessary sudo chmod 777 /var/lib/samba/usershares/
cd /var/lib/ cd samba/ ls now check weather uershares will appear green or not if yes then go ahead in terminal
Step 4: Restart Samba
After configuring the setting above, restart Samba by running the commands below.
sudo systemctl restart smbd
Step 5: Access the Share
Now log on to your other computers and access or map the share using the Ubuntu machine name or IP address.
You cam map the location if you’d like