Tutorial To Install Samba On Ubuntu 20.04 LTS
Samba is a free software re-implementation or open-source implementation of the SMB networking protocol. It was originally developed by Andrew Tridgell. It can function both as a domain controller or as a regular domain member.
In this tutorial, we will install Samba On Ubuntu 20.04 LTS and also configure it with Windows 10.
How To Install Samba on Ubuntu 20.04 LTS
With the help of Samba, We can share our share files with Windows systems. In this tutorial, we are using Windows 10. We need to name our workgroup and here we are going with the default Windows workgroup and that is WORKGROUP.
For this tutorial, we’re going to be using a 192.168.2.0/24 network. Our Ubuntu 20.04 LTS will be using 192.168.2.1, While Windows 10 will be using 126.96.36.199.
At first, we need to add Ubuntu 20.04 LTS to the Windows host file. To do this, run the following command in Windows:
Now, you need to add the local entry for the Ubuntu to be referenced by the named ubuntu2004 and save it.
192.168.1.3 ubuntu2004.localhost ubuntu2004
Now, we have to add the Windows system name in the Ubuntu host file too. Run the commands below and type the IP with the hostname of Windows, save the file, and exit.
sudo nano /etc/hosts
Now, we need to enable file-sharing. Run the following commands in Windows with administrative privilege.
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes netsh advfirewall firewall set rule group="Network Discovery" new enable=Yes
Install Samba On Ubuntu 20.04 LTS
Run the following commands:
sudo apt update sudo apt install samba
To verify the Samba services are running:
sudo systemctl status smbd
Let’s configure the Samba public share now.
Run the following command to open Samba configuration file by running the commands below. You should keep the backup of the file before editing.
sudo nano /etc/samba/smb.conf
Add the following line in
workgroup = WORKGROUP netbios name = ubuntu2004 security = user proxy = no map to guest = bad user . .
interfaces = 127.0.0.0/8 eth0 . .
server role = standalone server obey pam restrictions = yes . .
[public] path = /samba/public browseable = yes guest ok = yes guest only = yes read only = no force user = nobody force create mode = 0777 force directory mode = 0777
Now restart Samba services.
sudo systemctl restart smbd
You need to create a public folder where everyone should have access.
sudo mkdir -p /samba/public
Restart the Samba server. You can see the shared folder in Windows 10 or whatever Windows you are using.