This post shows the basic steps to share a directory over the network using SMB on the commandline. If you prefer a GUI program, see the post about using Samba Server Configuration tool.
$ sudo apt install samba smbclient
joe:$ sudo smbpasswd -a joe
Check if the username is listed in the database of Samba users:
$ sudo pdbedit -L -v
$ sudo chown joe /path/to/share
$ sudo chown :joe /path/to/share
$ sudoedit /etc/samba/smb.conf
Add a section at the end of the file for your share. You will need to provide it a name:
[joe-share]
path = /path/to/share
available = yes
valid users = joe
read only = no
browseable = yes
public = yes
writable = yes
To ensure your entry to smb.conf is correct, check if the share we added is listed in the output of this command:
$ testparm -s
$ sudo service smbd restart
or
$ sudo service samba restart
To check status of the shares and see which computers are connected to the shares:
$ sudo smbstatus
To check if the shares are visible locally to a Samba client:
$ smbclient -L localhost -U joe
192.168.0.10, then type this into the address bar of
Nautilus: smb://192.168.0.10/joe-share. You will be asked
to provide the username and password to access the share.Tried with: Samba 4.19.5 and Ubuntu 24.04