Install Samba Server on Ubuntu | Step-by-Step Guide

Sharing Files Between Ubuntu and Windows with Samba
For seamless file exchange between your Ubuntu and Windows systems, utilizing Samba file sharing is a highly effective solution. The initial step involves installation, which can be accomplished by opening a terminal window and executing the following command:
sudo apt-get install samba smbfs
With Samba now installed, the next phase focuses on its configuration to ensure accessibility. Execute the subsequent command to open the configuration file, utilizing your preferred text editor:
sudo gedit /etc/samba/smb.conf
Locating the Authentication Section
Within the configuration file, identify the following section:
####### Authentication ####### # "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba-HOWTO-Collection/ServerType.html
# in the samba-doc package for details.
; security = user
To enable user-level security, uncomment the 'security' line and introduce an additional line to modify the section as follows:
security = user
username map = /etc/samba/smbusers
This configuration directs Samba to consult the 'smbusers' file for user account information.
Creating a Samba User
Establishing a Samba user requires a two-step process. First, employ the 'smbpasswd' utility to generate a Samba password for the desired user:
sudo smbpasswd -a
Subsequently, add the username to the 'smbusers' file.
sudo gedit /etc/samba/smbusers
Insert a line in the following format, replacing '' with the actual username you wish to grant access to. The structure is = "". While mapping to a different Samba username is possible, it isn't essential at this stage.
= ""
With these steps completed, you are now able to define Samba shares and grant access to the users specified in this file.
Sharing User Home Directories
You can now proceed to create Samba shares and assign access permissions to the users you have configured.