Samba is a free software re-implementation of the SMB/CIFS networking protocol. Samba provides file and print services for various Microsoft Windows clients and can integrate with a Microsoft Windows Server domain.
First install the samba package:
$ sudo apt install samba
The configuration files are located at /etc/samba/smb.conf
Next we need to add a SMB user, used to sign-in to the SMB share. These user credentials need to match the existing Linux user's specifications exactly.
Creating a SMB user is provided by the smbpasswd command, followed by the -a flag, which specifies that we want to add a new user. Remember, the name and password needs to match the Linux user exactly.
$ sudo smbpasswd -a <user>
If you need to create multiple SMB users, go here.
As mentioned further above, the configuration files are located at /etc/samba/smb.conf
These this file is used to configure the relevant shares and permissions.
Adding a simple share, with only <user> having access to it, would require this configuration at the bottom of the config file:
[share] comment = Files valid users = <user> public = yes writable = yes browsable = yes path = "/path/to/share"
Samba includes a systemd service by default called smbd.service
Once your configurations are complete, you can start the SMB server:
$ sudo systemctl start smbd $ sudo systemctl enable smbd