How to Install and Use Samba on Ubuntu 20.04

Samba is a free implementation of Microsoft’s networking protocol and services for SMB (Server Message Block). A Samba share is a networked resource that Windows computers can access, similar to a “Windows share” in Microsoft terminology. It permits Microsoft Windows, Unix Linux, and other operating systems to network together, allowing Windows-based file and printer shares to be available. Samba’s use of SMB enables Windows clients to appear as Windows servers.

Samba is not vulnerable to WannaCry. WannaCry exploits a defect that only exists in Microsoft’s implementation of the SMB protocol specification. The defect is not a defect in the SMB protocol specification, and it is not a defect in other implementations of the SMB protocol.

WannaCry is not prone to Samba. WannaCry exploits a bug that exists only in the implementation of the SMB protocol specification by Microsoft. This is not a defect in the specification of the SMB protocol and it is not a defect in either  SMB protocol implementations.

Version 3.0.0

  • The ability to use LDAP and Kerberos to enter an Active Directory domain
  • Connections to Samba servers from Microsoft Windows XP Technical clients are enabled without the need for local registry hacking.
  • Built-in support for internationalization by Unicode

Samba Features

Samba is a server program that is efficient and flexible. Before attempting installation and setup, even experienced system administrators must consider its strengths.

What Samba is capable of:

  • Act as a Primary Domain Controller (PDC) Windows NT-style and also as a Backup Domain Controller (BDC) for a PDC.
  • Printers and Directory trees can be managed by clients on Linux, UNIX, and Windows.
  • Logins to Windows domains must be authenticated.
  • Provide name server resolution for Windows Internet Name Service (WINS).
  • Assist with surfing the internet (with or without NetBIOS)
  • Enter a PDC with Windows NT/2000/2003

Now, let’s step in towards the Samba Installation process on Ubuntu 20.04. Before following the installation guide, make sure that you are working as a ‘superuser’.

Installing and Using Samba on Ubuntu 20.04

Step 1: Open the terminal by pressing ‘CTRL+ALT+T’ or search it in the activities. The list of packages is going to be updated first.

$ sudo apt-get update

Step 2: On your system, tasksel should be present.

$ sudo apt install tasksel

Step 3: Use the tasksel command to install the Samba server.

$ sudo tasksel install samba-server

Step 4: Create a new one and copy the existing configuration file.

$ sudo cp /etc/samba/smb.conf  /etc/samba/smb.conf_backup

$ sudo bash -c ‘grep -v -E “^#|^;” /etc/samba/smb.conf_backup | grep . > /etc/samba/smb.conf’

Step 5: Add a user using the ‘adduser’ command and name it. Now, we will create a user named as ‘example’.

$ sudo adduser example

Step 6: Enter your SMB password for the user.

$ sudo smbpasswd -a example

Step 7: Add the following script to the samba configuration file.

$ sudo nano /etc/samba/smb.conf
[homes]
   comment = Home Directories
   browseable = yes
   read only = no
   create mask = 0700
   directory mask = 0700
   valid users = %S

Step 8: Create a new directory for Samba and change its permission to make it accessible for reading/writing operations.

$ sudo mkdir /var/samba
$ sudo chmod 777 /var/samba/

Enter the following content in the samba configuration file.

$ sudo nano /etc/samba/smb.conf
[public]
  comment = public anonymous access
  path = /var/samba/
  browsable =yes
  create mask = 0660
  directory mask = 0771
  writable = yes
  guest ok = yes

Step 9: Utilize the following command to restart smbd service.

$ sudo systemctl restart smbd

Step 10: Write out the following command to create a public share directory.

$ touch /var/samba/public-share 

 On your Windows, Click on ‘Network’. From the right-click menu select ‘Map Network Drive’.

Now add the folders you want to connect with and then access the samba directory.

Conclusion:

We have discussed What Samba is, its features, and its uses. Next, we have shown you a complete procedure to Install and Use Samba on your Ubuntu 20.04 system.