Samba facilitates file and printer sharing among Linux and Windows systems. To share contents of linux server there should be a sharing server running, mostly Samba is used as sharing server on linux machines.
Follow the steps below to install Samba on PC where you need to share files.
Create configuration file for Samba, it is required but not automatically created when installing samba so have to manually create it.
Copy the content from Sample Configuration from Samba Git Repo and paste in above file.
Lets modify configuration to get it working.
For better security provide min protocol and max protocol versions, add protocols in global section.
Set workgroup, you can set your own workgroup name, I set it DEVTEAM
Set server description, this is visible when querying server from samba client, my PC host name is TECNOTCH
Change the default log file path as it is not writable, set it to
Restrict home directories being shared, add ; before every line in [homes] section
At the end of file uncomment [myshare] section and change as required, this is the share name that appears on client, I changed [myshare] to [shared]
We have done configurations, Great. Now save the file using :wq and add users to samba server
Samba server requires user to access user shared directories if those are not public, Samba shares the linux system user name but maintains its own password.
So we don’t have to actually add the user but we are going to add a password in Samba list.
Type your password and enter
You can change password later by using
Create the shareable directory
Remember we have created a [shared] section in smb.conf file? There we have configured path for shareable directory
Create a directory shared in /mnt/data location
Change ownership of file to the user that was added in samba, in my case it was tofeeq, assign ownership to tofeeq for /mnt/data/shared directory
Cool, all setup now start the samba server
You can set them autostart on system boot
Congratulations, your samba server is up and running, now you can access your linux server’s shared folders from any other pc including windows. To access them on linux you need to have samba client and mount network directory.