SAMBA Server Configuration
(Server Message Block Protocol)
Samba allows you to set up a shared folder or directory on a server that can be
accessed by Windows, Linux, and macOS computers.
1. Rollback plan, take a snapshot before any ac�vity
2. Configure repo for installa�on
3. Install Package #dnf install samba.x86_64
4. Server Configura�on
i. we are going to create a samba share called /data in
the /srv/tecmint/ directory path #mkdir -p /srv/tecmint/data (-p
for creating parent directories)
ii. we will assign permissions and ownership as follows
#chmod -R 755 /srv/tecmint/data
#chown -R nobody:nobody /srv/tecmint/data
#chcon -t samba_share_t /srv/tecmint/data
iii. Next, we are going to make some configurations in
the [Link] configuration file which is Samba’s main
configuration file. But before we do so, we will back up the file
by renaming it with a different file extension.
#mv /etc/samba/[Link] /etc/samba/[Link]
iv. Next we are going to create new config file with vim editor
#vim /etc/samba/[Link] We will define policies on who can
access the samba share by adding the lines shown in the
configuration file.
v. To verify the configurations made, run the command: #testparm
vi. Next start and enable samba daemons
#systemctl start smb
#systemctl enable smb
#systemctl start nmb
#systemctl enable nmb
Verify daemons status whether its started or not
#systemctl status smb
#systemctl status nmb
5. Disable Firewall and SElinux for remote tes�ng
#systemctl stop fi[Link]
#setenforce0
6. For remote tes�ng we need linux’s IP where server is configured, then in
windows win+R to open Run and enter your server’s ip like this
\\[Link]
Press OK to Open shred directory between Linux and windows
7. Now in linux go to #cd /srv/tecmint/data create some files
#touch file{1..3}
8. Now, we will navigate to the ‘Public‘ folder where the files we created
earlier will be displayed.
As you can see files which we created in linux is seen in windows folder
9. We have successfully managed to access our samba share. However,
our directory is accessible to anyone and everybody can edit and delete
files at will, which is not recommended especially if you plan to host
sensitive files.
10. We need to create user and groupand gave password to it for secure
samba share #useradd smbuser #smbpasswd -a smbuser
#usermod -g smb_group smbuser
#pdbedit -L to check samba user
11. Create yet another samba share which will be securely accessed. In
our case, we have created another directory in the same path as the
#mkdir -p /srv/tecmint/private
12. Then configure the file permissions for the samba share directory
#chmod -R 770 /srv/tecmint/private
#chcon -t samba_share_t /srv/tecmint/private
#chown -R root:smb_group /srv/tecmint/private
13. Access the Samba configuration file #vi /etc/samba/[Link] and add
these lines to define to secure samba share.
Save and exit
14. Finally, restart all the samba daemons as shown.
#systemctl restart smb
#systemctl restart nmb
15. Now access samba share through windows
As you can see there is private and public share directories, Now we try to
access Private share samba and it’ll ask username and password
(Asking for samba user and password)
(A�er giving creden�als )
(Here we are trying to delete some file but it denied due to permissinons we set for private
samba share directory)