How to Install Samba on Elementary OS

Samba is a free and open-source software that enables file and printer sharing between Linux and Windows systems. In this tutorial, we'll guide you through the steps of installing Samba on Elementary OS Latest.

Prerequisites

Before you begin, ensure your system is up to date:

sudo apt update && sudo apt upgrade

Step 1: Install Samba

First, update the package list of your system:

sudo apt update

Next, install Samba:

sudo apt install samba

Step 2: Create a Samba user

In order to create a Samba share, you need a Samba user. To create a Samba user, use the following command:

sudo smbpasswd -a username

Replace username with the name of the user you want to create.

Step 3: Configure Samba

Samba can be configured using the smb.conf file. The default configuration file is located at /etc/samba/smb.conf.

To backup the default configuration file, run:

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

You can then edit the smb.conf file using your preferred text editor. For example, to edit the file using the nano editor, run:

sudo nano /etc/samba/smb.conf

Step 4: Create a Samba share

To create a Samba share, add the following lines to the smb.conf file:

[sharename]
   path = /path/to/shared/folder
   writable = yes
   read only = no
   guest ok = no
   valid users = username

Replace sharename with the desired name of the share, /path/to/shared/folder with the path of the folder you want to share, and username with the name of the Samba user you created in step 2.

Step 5: Restart Samba

After configuring Samba, restart the Samba service to apply the changes:

sudo service smbd restart
sudo service nmbd restart

Step 6: Access the shared folder

You can access the shared folder from a Windows machine by typing \\ip-address\sharename in the File Explorer address bar, where ip-address is the IP address of your Elementary OS system. You will be prompted to enter the username and password of the Samba user you created in step 2.

Congratulations, you have successfully installed and configured Samba on your Elementary OS system!

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!