How to install Samba server on Ubuntu?

  1. First, open up the terminal on your Ubuntu machine.

  2. Update your system’s package list using the following command:

1
sudo apt update
  1. Once the package list is updated, you can install Samba server by running the following command:
1
sudo apt install samba
  1. During the installation process, the system will prompt you to configure your Samba server. You can select “No” to the first option (“WINS support”) and “Yes” to the second option (“Create a new Samba configuration file”).

  2. Once the installation is complete, you can open up the configuration file using your preferred text editor. Here’s an example using the built-in Nano editor:

1
sudo nano /etc/samba/smb.conf
  1. In the configuration file, you can define shared directories and set up authentication. Here’s an example of how you can define a sample shared directory:
1
2
3
4
[Shared Folder]
path = /srv/samba/share
read only = no
guest ok = yes

In this example, “Shared Folder” is the name of the share that you want to create, “/srv/samba/share” is the path to the directory you want to share, “read only” is set to “no” so users can write to the share, and “guest ok” is set to “yes” to allow unauthenticated access.

  1. Once you have defined your shares in the configuration file, you can restart the Samba server using the following command:
1
sudo systemctl restart smbd

That’s it! You should now have a working Samba server on your Ubuntu machine.