We can create and share a directory on the network with Windows clients using Samba. This is an open source package providing a fast, stable and secure implementation of the CIFS/SMB protocol.
Installing Samba
Open up your terminal of choice and install the required packages.
Create a directory to share. Don’t worry too much about what this is called or where it’s located. The directory name won’t be seen and we can symlink in any additional folders. Let’s just create a folder called samba-share under our home directory.
We now need to edit the Samba configuration file but let’s create a backup first.
Open up the /etc/samba/smb.conf
file in your editor of choice (vim, nano, leafpad)
Before we start bear in mind that whitespace matters in this file so make sure you include the spaces before and after the =.
First we add the following line to the [global] section. This section will already exist in the file, so just place the line at the top. This line isn’t entirely necessary but it will allow us to symlink other directories into the share and let windows clients navigate these.
Now we add the configuration for our new share at the bottom of the file. For more info on what each line does see the smb.conf docs on the samba.org website.
Save and close the file.
Create a Samba user and set a password. The username doesn’t have to be the same as your login name although I usually keep it the same for simplicity.
Stop and restart the required services
We’re done!
If you now open file explorer (Nautilus etc) and navigate to smb://localhost
you should see the new share available. As long as you see this you can now go ahead and map a network drive to this share from windows using the username and password you just created.