Samba is the name of the open source version of the protocol that the Windows operating system uses to share files. It is useful because it is fairly well supported on Linux, Mac and Windows machines although Windows likes to change things to make it harder sometimes. The steps below will set up a simple share using the default users Public folder in Ubuntu 18.04.
First you need to install Samba. To do so open up a terminal by clicking on Activities in the top left of the screen and then typing terminal and pushing enter. Then, in the terminal you can type,
sudo apt -y install samba
And push enter to execute the command. This will install the Samba server if it wasn’t previously installed. The next step is to add yourself as a samba user. You have to be a user already to be a Samba user so use your existing user-name or it won’t work.
In the terminal again, type,
sudo smbpasswd -a <insert user-name>
Where <user-name> is your user-name. It will then ask you to enter your password and then confirm it. You don’t have to use your account password. In fact it is more secure to use a different one for networking as you tend to have to give it out so other people can access it.
The next step is to backup the configuration file and then edit it. You can backup the file by typing in the terminal (or copying and pasting in this case),
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
This will create a copy of the Samba configuration and name it smb.conf_backup so, if your file ever gets messed up and you need to go back to the start, you will have an original copy.
You can then edit the file using a program called nano. It is a text editor that works in the terminal. Open the smb.conf file with it by typing,
sudo nano /etc/samba/smb.conf
After the file has opened, you need to go to the very bottom of the file. This can be done using the down arrow or your mouse wheel. Once there, on a new line, you need to paste this share definition. You can change it in nano if you want but it might be easier to change it in a visual text editor like Gedit. That can also be found in the Activities menu. Basically, you need to change all the parts in <includingthebrackets> to suit your own installation.
[<share name>] path = /home/<username>/Public/ available = yes valid users = <username> read only = no browseable = yes public = yes writable = yes
So if my user name was squalidh then the share would look like,
[Squalidh Share] path = /home/squalidh/Public/ available = yes valid users = squalidh read only = no browseable = yes public = yes writable = yes
After finishing save the file in nano using ctl+x (press control and then the key x) and restart the samba server with the command,
sudo systemctl restart smbd
Then open up Nautilus, the file manager, and on the left there should be a heading Other Locations. Select that then Windows Network and your Workgroup should show up. It should also be called Workgroup as that is the default. Entering that should show your computer name and then entering that should show your share name (Squalidh Share from above). You will be asked to enter your samba user password before being able to enter that directory at which point you will see the folder Public that you have shared. This is the same Public folder that is inside your home directory.
That should be it. You should be able to create and destroy files in that directory and so should anyone on the network with your user name and password.