Samba is open source software and it uses the TCP / IP protocol. Basically the samba is an implementation of SMB (server message block) and CIFS (common internet file system) protocol. The main advantage of samba is it provide file and print sharing services between AlmaLinux / Rocky Linux / Amazon Linux and Other O.S.

Samba supported platforms:

  • Linux
  • Windows
  • Solaris 2.above
  • Aix
  • OpenBSD
  • SunOS 4 above
  • and more…..

Samba Packages Quick Review

  • samba
  • samba-client
  • samba-common
  • samba-winbind
  • and some others

Install SAMBA server

First of all Now check whether your yum is configured and Install necessary packages

# yum install samba* -y

After that The samba packages are installing now.

SAMBA Daemons:

  • nmbd: The nmbd daemons provides NetBIOS (Network Basic Input/output system) nameserving and browsing support. A daemon that looks after the Windows Internet Name Service (WINS) and assist with browsing. But according to samba documentation, it should be the first daemon to start.
  • Smbd : It manages file transfers and authentication.
  • Winbind : It started to handle Microsoft Windows Domain membership.

To check status

# systemctl status nmb
nmbd is stopped
# systemctl status smb 
smbd is stopped
# systemctl status winbind 
winbind is stopped

Configuration File:

Secondly The main configuration file is smb.conf and the path of configuration file is /etc/samba/smb.conf.

It is divided into four sections:

  • global : General samba configuration parameters.
  • homes : Allow users to access their home directories.
  • printers : Used for configuring printers and printers entries related to shared printers.
  • shares : Define other shares available.

SAMBA server side

After that So let’s start to configure SAMBA server on server side.

Then We share /techbrown file. So first create a /techbrown directory and create some files into /techbrown directory.

# mkdir /techbrown
# touch /techbrown/file {1..10}

Finally Now we edit configuration file of samba and make some changes and entries in it.

# vim /etc/samba/smb.conf

Configure SAMBA server

Now You can change a WORKGROUP from the global section.

After that go to the Share Definitions section. So we first see the Directory Sharing Options [techbrown] -> Share name which will be displayed.
comment = Access files stores -> Comment displayed in Network.
path = /techbrown -> Path of directory associated with the share.
host allow = address -> Specify which domain can access this share ( Also you can make entry of it in global section).
host deny= address -> Specify which domain can’t access this share.
valid users = username -> Name of users who can access the share.
public = No/Yes -> Specify whether guest user can access this share or not.
writable = No/yes -> Specify whether the shared directory is writable or not.
browseable = No/Yes -> specify whether the shared directory should be visible or not.

So let’s start with our configuration.

path = /techbrown
host allow =
host deny =
browseable = yes
writable = yes
valid users = techbrown

Save this using :wq
Now it’s time to start your service.

# service smb start
Starting SMB services:                                     [  OK  ]
# systemctl enable smb

I already have user having username techbrown. If you want to add user follow these steps.

# useradd techbrown

Now it’s time to provide a password to the user.

# smbpasswd   -a  techbrown
New SMB password : ****
Retype new SMB password : ****

Added user techbrown.

But because of SELINUX policy client will not get access from server. SELINUX is the complex security features of Linux. It will happen if your SELINUX configured as “enforcing” in targeted mode.

Let’s talk about some Booleans

samba_export_all_ro -> Enable read only access to any directory.
samba_export_all_rw -> Enable read write access to any directory.
samba_enable_home_dirs -> Enable the sharing of a home directory.
samba_share_t Directory name-> Enables which samba can share.
So we have to enable this policy. For this just do one thing.

# ls -ldZ /techbrown
drwxr-xr-x. root root unconfined_u:object_r:default_t:s0 /techbrown

So to enable SELINUX environment run chcon command to change the context.

# chcon -R -t samba_share_t /techbrown
# ls -ldZ /techbrown
drwxr-xr-x. root root unconfined_u:object_r:samba_share_t:s0 /techbrown

Configure SAMBA at Linux Client Side

Now we are ready to use this share on Client side. To do this, you have to install samba-client package for Linux client. After that do following

“smbclient” command is use to connect with your share.


smbclient //ipaddr/sharename -U username

#  smbclient     //  -U   techbrown
Enter techbrown's password: ****
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.5.4-68.el6]
smb: \>

Check On windows client side

Right click on “My Computer” click on “properties”.
Click on change setting
Change workgroup name with your Workgroup name.
Start —-> Run.
It will ask you username and password, type it and access the file.

Congratulations now you have configured the Samba server on AlmaLinux / Rocky Linux / Amazon Linux.