How to Install Samba on Arch Linux

In this tutorial, we will guide you through the installation process of Samba, a free and open-source software suite that enables file and printer sharing between Windows and Linux/Unix systems.

Prerequisites

Before we start, make sure you have the following:

Step 1: Update System

As always, it's good practice to start by updating your system. To do so, open a terminal window and execute the following command:

sudo pacman -Syu

This command will update your system to the latest packages and dependencies.

Step 2: Install Samba

To install Samba on your Arch Linux system, use the standard pacman package manager.

sudo pacman -S samba

This command will download and install Samba from the official Arch Linux repositories.

Step 3: Configure Samba

After installing Samba, you need to configure it. The Samba configuration file is located at /etc/samba/smb.conf.

To open this file using your preferred text editor, run:

sudo nano /etc/samba/smb.conf

In this file, you can specify the shared directories, workgroup name, and other settings.

Let's add a new share directory to the Samba configuration file:

[shared]
   comment = Shared Files
   path = /mnt/shared
   read only = no
   guest ok = yes

Save and exit the file by pressing CTRL + X, then Y, and finally Enter.

Step 4: Start and Enable Samba Service

Now, start the Samba service by running the following command:

sudo systemctl start smb.service

To enable Samba to start automatically at boot time, run:

sudo systemctl enable smb.service

Step 5: Configure Firewall

If you have a firewall enabled on your Arch Linux system, you need to allow Samba traffic.

For example, if you are using UFW as your firewall, you can allow the necessary traffic by running:

sudo ufw allow Samba

Step 6: Accessing Samba Shares

Finally, to access Samba shares from Windows or other Samba-compatible clients, you need to know the IP address of your Arch Linux system.

To find the IP address, use the following command:

ip addr show | grep inet

You will see the IP address along with the network interface name, e.g., enp0s3, wlp0s20f3, etc.

Now, on your Windows machine, open File Explorer, and enter the following into the address bar:

\\<ip_address>\shared

Replace <ip_address> with your Arch Linux system IP address.

You will be prompted to enter the username and password of the Samba user you created earlier.

Congratulations! You have successfully installed and configured Samba on Arch Linux.

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!