Configure Samba Share on Arch | Manjaro | Garuda Linux

Samba is a free and open-source software that makes it easy for Windows and Linux/Unix systems to share files over a network. Samba is basically a reimplementation of the SMB and CIFS networking protocols in an open-source format. In addition to file sharing between clients and hosts, Samba provides file sharing, printing, and domain control services within the network.

We’ll go through how to install and configure Samba file sharing on Arch | Manjaro | Garuda Linux in this post.

Install and Configure Samba Share on Arch | Manjaro | Garuda Linux

Follow the steps below in order to install and configure Samba share on Arch, Manjaro and Garuda operating systems.

Step 1: Install Samba Packages on Arch | Manjaro | Garuda Linux

To update your Linux system, first log in to your system, open a terminal, and then perform the command below:

sudo pacman -Syu

Run this command in a terminal to install Samba:

sudo pacman -S samba smbclient

Now, start the installation process:

resolving dependencies...
looking for conflicting packages...

Package (2)      Old Version  New Version  Net Change  Download Size

extra/samba                   2:4.22.0-1    62.40 MiB       8.48 MiB
extra/smbclient  2:4.21.4-1   2:4.22.0-1     0.26 MiB       6.95 MiB

Total Download Size:   15.42 MiB
Total Installed Size:  90.57 MiB
Net Upgrade Size:      62.66 MiB

:: Proceed with installation? [Y/n] Y

Step 2: Configure Samba Share on Arch | Manjaro | Garuda Linux

We’ll conduct some settings now that Samba is deployed to improve the application’s performance.

The /etc/samba/smb.conf configuration file is used to set up Samba. Because the samba package does not include this file, it must be created before smb.service can be started.

Run the following command to create smb.conf file:

sudo vim /etc/samba/smb.conf

Add the following contents to the file created above:

# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options (perhaps too
# many!) most of which are not shown in this example
#
# For a step to step guide on installing, configuring and using samba, 
# read the Samba-HOWTO-Collection. This may be obtained from:
#  http://www.samba.org/samba/docs/Samba-HOWTO-Collection.pdf
#
# Many working examples of smb.conf files can be found in the 
# Samba-Guide which is generated daily and can be downloaded from: 
#  http://www.samba.org/samba/docs/Samba-Guide.pdf
#
# Any line which starts with a ; (semi-colon) or a # (hash) 
# is a comment and is ignored. In this example we will use a #
# for commentry and a ; for parts of the config file that you
# may wish to enable
#
# NOTE: Whenever you modify this file you should run the command "testparm"
# to check that you have not made any basic syntactic errors. 
#
#======================= Global Settings =====================================
[global]

# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH
   workgroup = MYGROUP

# server string is the equivalent of the NT Description field
   server string = Samba Server

# Server role. Defines in which mode Samba will operate. Possible
# values are "standalone server", "member server", "classic primary
# domain controller", "classic backup domain controller", "active
# directory domain controller".
#
# Most people will want "standalone server" or "member server".
# Running as "active directory domain controller" will require first
# running "samba-tool domain provision" to wipe databases and create a
# new domain.
   server role = standalone server

# This option is important for security. It allows you to restrict
# connections to machines which are on your local network. The
# following example restricts access to two C class networks and
# the "loopback" interface. For more examples of the syntax see
# the smb.conf man page
;   hosts allow = 192.168.1. 192.168.2. 127.

# Uncomment this if you want a guest account, you must add this to /etc/passwd
# otherwise the user "nobody" is used
;  guest account = pcguest

# this tells Samba to use a separate log file for each machine
# that connects
   log file = /usr/local/samba/var/log.%m

# Put a capping on the size of the log files (in Kb).
   max log size = 50

# Specifies the Kerberos or Active Directory realm the host is part of
;   realm = MY_REALM

# Backend to store user information in. New installations should 
# use either tdbsam or ldapsam. smbpasswd is available for backwards 
# compatibility. tdbsam requires no further configuration.
;   passdb backend = tdbsam

# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting.
# Note: Consider carefully the location in the configuration file of
#       this line.  The included file is read at that point.
;   include = /usr/local/samba/lib/smb.conf.%m

# Configure Samba to use multiple interfaces
# If you have multiple network interfaces then you must list them
# here. See the man page for details.
;   interfaces = 192.168.12.2/24 192.168.13.2/24 

# Where to store roving profiles (only for Win95 and WinNT)
#        %L substitutes for this servers netbios name, %U is username
#        You must uncomment the [Profiles] share below
;   logon path = \\%L\Profiles\%U

# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable it's WINS Server
;   wins support = yes

# WINS Server - Tells the NMBD components of Samba to be a WINS Client
#	Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
;   wins server = w.x.y.z

# WINS Proxy - Tells Samba to answer name resolution queries on
# behalf of a non WINS capable client, for this to work there must be
# at least one	WINS Server on the network. The default is NO.
;   wins proxy = yes

# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names
# via DNS nslookups. The default is NO.
   dns proxy = no 

# These scripts are used on a domain controller or stand-alone 
# machine to add or delete corresponding unix accounts
;  add user script = /usr/sbin/useradd %u
;  add group script = /usr/sbin/groupadd %g
;  add machine script = /usr/sbin/adduser -n -g machines -c Machine -d /dev/null -s /bin/false %u
;  delete user script = /usr/sbin/userdel %u
;  delete user from group script = /usr/sbin/deluser %u %g
;  delete group script = /usr/sbin/groupdel %g


#============================ Share Definitions ==============================
[homes]
   comment = Home Directories
   available = no
   browseable = yes
   writable = yes

# Un-comment the following and create the netlogon directory for Domain Logons
; [netlogon]
;   comment = Network Logon Service
;   path = /usr/local/samba/lib/netlogon
;   guest ok = yes
;   writable = no
;   share modes = no


# Un-comment the following to provide a specific roving profile share
# the default is to use the user's home directory
;[Profiles]
;    path = /usr/local/samba/profiles
;    browseable = no
;    guest ok = yes


# NOTE: If you have a BSD-style print system there is no need to 
# specifically define each individual printer
;[printers]
;   comment = All Printers
;   path = /usr/spool/samba
;   browseable = no
# Set public = yes to allow user 'guest account' to print
 ;  guest ok = no
 ;  writable = no
 ;  printable = yes


[myfiles]
    comment = User1
    path = /srv/myfiles
    public = no
    only guest = yes
    writable = yes

# This one is useful for people to share files
;[tmp]
;   comment = Temporary file space
;   path = /tmp
;   read only = no
;   public = yes

# A publicly accessible directory, but read only, except for people in
# the "staff" group
;[public]
;   comment = Public Stuff
;   path = /home/samba
;   public = yes
;   writable = no
;   printable = no
;   write list = @staff

# Other examples. 
#
# A private printer, usable only by fred. Spool data will be placed in fred's
# home directory. Note that fred must have write access to the spool directory,
# wherever it is.
;[fredsprn]
;   comment = Fred's Printer
;   valid users = fred
;   path = /homes/fred
;   printer = freds_printer
;   public = no
;   writable = no
;   printable = yes

# A private directory, usable only by fred. Note that fred requires write
# access to the directory.
;[fredsdir]
;   comment = Fred's Service
;   path = /usr/somewhere/private
;   valid users = fred
;   public = no
;   writable = yes
;   printable = no

# a service which has a different directory for each machine that connects
# this allows you to tailor configurations to incoming machines. You could
# also use the %U option to tailor it by user name.
# The %m gets replaced with the machine name that is connecting.
;[pchome]
;  comment = PC Directories
;  path = /usr/pc/%m
;  public = no
;  writable = yes

# A publicly accessible directory, read/write to all users. Note that all files
# created in the directory by users will be owned by the default user, so
# any user with access can delete any other user's files. Obviously this
# directory must be writable by the default user. Another user could of course
# be specified, in which case all files would be owned by that user instead.
;[public]
;   path = /usr/somewhere/else/public
;   public = yes
;   only guest = yes
;   writable = yes
;   printable = no

# The following two entries demonstrate how to share a directory so that two
# users can place files there that will be owned by the specific users. In this
# setup, the directory should be writable by both users and should have the
# sticky bit set on it to prevent abuse. Obviously this could be extended to
# as many users as required.
;[myshare]
;   comment = Mary's and Fred's stuff
;   path = /usr/somewhere/shared
;   valid users = mary fred
;   public = no
;   writable = yes
;   printable = no
;   create mask = 0765

Samba-servers on Linux provide the users /home-directory as a shared-folder automatically. To prevent this, we’ve set available = no in the [homes] section. If you prefer the home directory shared, remove the available parameter or set it to yes.

[homes]
   comment = Home Directories
   available = no
   browseable = yes
   writable = yes

The log file is assigned to a non-writable place by default, which can cause problems; use one of the following workarounds. In the above file, change log file = /usr/local/samba/var/log.%m as follows;

log file = /var/log/samba/%m.log

Run the following command to check for syntactic errors in smb.conf file:

$ sudo testparm
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Weak crypto is allowed by GnuTLS (e.g. NTLM as a compatibility fallback)

Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

# Global parameters
[global]
        dns proxy = No
        log file = /usr/local/samba/%m.log
        max log size = 50
        server role = standalone server
        server string = Samba Server
        workgroup = MYGROUP
        idmap config * : backend = tdb


[homes]
        available = No
        comment = Home Directories
        read only = No


[myfiles]
        comment = User1
        guest only = Yes
        path = /srv/myfiles
        read only = No

Now, enable and start smb.service and nmb.service:

sudo systemctl start smb
sudo systemctl enable smb
sudo systemctl start nmb
sudo systemctl start nmb

Verify status of both smb and nmb that are active and running:

SMB:

 ╭─[email protected] in ~ as 🧙 took 0s
 ╰─λ sudo systemctl status smb
● smb.service - Samba SMB Daemon
     Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; preset: disabled)
     Active: active (running) since Fri 2025-03-28 01:24:05 EAT; 2s ago
 Invocation: 08c2c301a6d9450a98edf22dae630ab5
       Docs: man:smbd(8)
             man:samba(7)
             man:smb.conf(5)
   Main PID: 4109 (smbd)
     Status: "smbd: ready to serve connections..."
      Tasks: 3 (limit: 7074)
     Memory: 7.7M (peak: 8M)
        CPU: 65ms
     CGroup: /system.slice/smb.service
             ├─4109 /usr/bin/smbd --foreground --no-process-group
             ├─4113 "smbd: notifyd "
             └─4114 "smbd: cleanupd"

Mar 28 01:24:05 garuda.cloudspinx.com systemd[1]: Starting Samba SMB Daemon...
Mar 28 01:24:05 garuda.cloudspinx.com smbd[4109]: [2025/03/28 01:24:05.132964,  0] ../../source3/smbd/server.c:1971(main)
Mar 28 01:24:05 garuda.cloudspinx.com smbd[4109]:   smbd version 4.22.0 started.
Mar 28 01:24:05 garuda.cloudspinx.com smbd[4109]:   Copyright Andrew Tridgell and the Samba Team 1992-2025
Mar 28 01:24:05 garuda.cloudspinx.com systemd[1]: Started Samba SMB Daemon.

NMB:

╭─[email protected] in ~ as 🧙 took 0s
 ╰─λ sudo systemctl status nmb
● nmb.service - Samba NMB Daemon
     Loaded: loaded (/usr/lib/systemd/system/nmb.service; enabled; preset: disabled)
     Active: active (running) since Fri 2025-03-28 01:26:40 EAT; 14s ago
 Invocation: 0e0cdcb6e57545039f0d31a42a48f3a8
       Docs: man:nmbd(8)
             man:samba(7)
             man:smb.conf(5)
   Main PID: 4229 (nmbd)
     Status: "nmbd: ready to serve connections..."
      Tasks: 1 (limit: 7074)
     Memory: 3.1M (peak: 3.7M)
        CPU: 37ms
     CGroup: /system.slice/nmb.service
             └─4229 /usr/bin/nmbd --foreground --no-process-group

Mar 28 01:26:40 garuda.cloudspinx.com systemd[1]: Starting Samba NMB Daemon...
Mar 28 01:26:40 garuda.cloudspinx.com nmbd[4229]: [2025/03/28 01:26:40.966897,  0] ../../source3/nmbd/nmbd.c:901(main)
Mar 28 01:26:40 garuda.cloudspinx.com nmbd[4229]:   nmbd version 4.22.0 started.
Mar 28 01:26:40 garuda.cloudspinx.com nmbd[4229]:   Copyright Andrew Tridgell and the Samba Team 1992-2025
Mar 28 01:26:40 garuda.cloudspinx.com systemd[1]: Started Samba NMB Daemon.

Step 3: Enabling Secure Samba Share on Arch | Manjaro | Garuda Linux

Now create samba share user, replacing gedionkip with your user name:

$ sudo smbpasswd -a gedionkip
New SMB password: <input password >
Retype new SMB password: <repeat password>
Added user gedionkip.

Run the following command to list user created above:

$ sudo pdbedit -L -v
---------------
Unix username:        gedionkip
NT username:          
Account Flags:        [U          ]
User SID:             S-1-5-21-1387696145-3827174509-1377079002-1000
Primary Group SID:    S-1-5-21-1387696145-3827174509-1377079002-513
Full Name:            Gedion Kiprotich
Home Directory:       \\GARUDA\gedionkip
HomeDir Drive:        
Logon Script:         
Profile Path:         \\GARUDA\gedionkip\profile
Domain:               GARUDA
Account desc:         
Workstations:         
Munged dial:          
Logon time:           0
Logoff time:          Wed, 06 Feb 2036 18:06:39 EAT
Kickoff time:         Wed, 06 Feb 2036 18:06:39 EAT
Password last set:    Fri, 28 Mar 2025 01:33:07 EAT
Password can change:  Fri, 28 Mar 2025 01:33:07 EAT
Password must change: never
Last bad password   : 0
Bad password count  : 0
Logon hours         : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

You can also change the gedionkip password by running the following command:

sudo smbpasswd gedionkip

Non-root users can create, edit, and remove their own share definitions using the Usershares functionality.

Create a directory for usershares:

sudo mkdir /srv/myfiles
#Add content to created directory
touch text.txt index.php README.md

Create a user group:

sudo groupadd -r sambauser

Change the owner of the directory created above to root and the group to sambauser:

sudo chown root:sambauser /srv/myfiles

Change the permissions of the myfiles directory so that users in the group sambauser can read, write and execute files:

sudo chmod -R 770 /srv/myfiles

In the smb.conf configuration file, set the following parameters:

[myfiles]
    comment = User1        #User1 accessing the directory.
    path = /srv/myfiles    #the directory User1 has permission to access
    public = no            #nobody else has the permission to access the directory except User1
    guest ok = no.         #ensures only valid users can access
    writable = yes         #User1 have write access to the directory

Add the User1 to the sambauser group:

 ╭─[email protected] in ~ as 🧙 took 0s
 ╰─λ sudo gpasswd sambauser -a gedionkip
Adding user gedionkip to group sambauser

Restart smb.service and nmb.service services:

sudo systemctl restart smb
sudo systemctl restart nmb

Step 4: Configure Samba client

Linux Systems

We’ll need to install Samba client to be able to access the Samba share directory from another machine. I’m going to install Samba client on Ubuntu Linux.

sudo apt install -y samba-client cifs-utils

Run the command with the syntax indicated below to gain temporary access to a Samba share:

smbclient //sambaserver-ip/share-dir -U sambauser

Look at the following example:

cloudspinx@ubuntu-24:~$ smbclient //192.168.1.196/myfiles -U gedionkip
Password for [WORKGROUP\gedionkip]:
Try "help" to get a list of possible commands.
smb: \> ls
  .                                   D        0  Fri Mar 28 01:54:50 2025
  ..                                  D        0  Fri Mar 28 01:54:50 2025
  text.txt                            N        0  Fri Mar 28 01:54:09 2025
  README.md                           N        0  Fri Mar 28 01:54:09 2025
  index.php                           N      221  Fri Mar 28 01:54:50 2025

                41936656 blocks of size 1024. 28114344 blocks available
smb: \> 

For persistent access, mount the Samba share to a directory:

sudo mkdir -p /mounts/shares
sudo mount -t cifs -o username=gedionkip //192.168.1.196/myfiles /mounts/shares

Confirm if the directory is mounted on client:

$ df -h
Filesystem              Size  Used Avail Use% Mounted on
udev                    3.9G     0  3.9G   0% /dev
tmpfs                   787M  2.0M  785M   1% /run
/dev/sda2               297G  183G  100G  65% /
tmpfs                   3.9G  147M  3.7G   4% /dev/shm
/dev/loop11              51M   51M     0 100% /snap/snap-store/547
tmpfs                   787M   56K  787M   1% /run/user/1000
//192.168.1.196/myfiles  36G  9.1G   27G  26% /mounts/shares

Mount the samba share in the fstab file to enable permanent mounting even after a reboot:

$ sudo vim /etc/fstab
//192.168.1.196/gedionkip  /mnt/shares cifs credentials=/.sambacreds 0 0

Save the file and exit the create the credentials file:

$ sudo vim /.sambacreds

Add the login credentials info:

username: user1
password: mypassword
domain: WORKGROUP

Now, you confirm if mounted:

$ sudo mkdir -p /mnt/shares 
$ sudo mount -a 
$ df -hT | grep cifs
//192.168.1.196/gedionkip cifs      36G  9.1G  27G  26% /mnt/shares
Accessing Samba Secure files using Windows Systems.

To access shared folders, open file explorer and click on Network and type the server hostname or IP address in the bar then click enter.

Enter the username and password of the sambauser and hit enter. When you press enter you will see a shared folder myfiles as shown below.

Files generated in a myfiles directory on a Samba sharing server are shown below:

Conclusion

You’ve successfully installed Samba on Arch | Manjaro | Garuda Linux and mounted the shared directory on Ubuntu and Windows clients.

More guides to check:

Your IT Journey Starts Here!

Ready to level up your IT skills? Our new eLearning platform is coming soon to help you master the latest technologies.

Be the first to know when we launch! Join our waitlist now.

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

Any network professional need a boost in their skills when it comes to network routing, switching, general troubleshooting, IP addressing, […]

Java is a programming language developed by James Gosling together with Mike Sheridan and Patrick Naughton in 1995 for Sun […]

This is a personal message of gratitude to all operations experts who toil day and night to ensure that applications, […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.