Linux-samba1
Linux

How to configure samba in Linux Part1

0 710

We welcome you to another exciting tutorial . We will learn how to make linux folder or directory shareable for linux and non linux servers. In this tutorial we will demonstrate sharing between linux and windows. . The functionality which provides this sharing between linux and windows  is samba tool.  This tool not only allows you to share file or directory but also you can share printers and configure it as domain controller.This will give you a start and later you can explore different possibilities/ ideas

Introduction

Samba is a package which run on *nix systems. It uses TCP/IP protocol to communicate when correctly configured and interact with windows file server as well. The daemon of samba is smb (Server Message Block) and it is also known as CIFS (Common Internet File System), this operates application layer network protocol. It listens on port number 137, 138 and 139.

Installation Of Samba in Linux

By using yum command we can install samba.

[root@faraz fahmed]# yum -y install samba samba-client

Make a folder for share by using below command.

[root@faraz fahmed]# mkdir /home/share.folder

Set the permission with full access.

[root@faraz fahmed]# chmod 777 /home/share.folder

Now open configuration file to change or edit some parameters in below image you have to change the workgroup for windows domain or workgroup by default it shows MYGROUP and also host allow in the network-related options area. In the end of file add these lines which are starting from [share.folder] with full rights.

[root@faraz fahmed]# vi /etc/samba/smb.conf


# ----------------------- Network-Related Options -------------------------

workgroup = WORKGROUP     # for windows system you need define this is the default workgroup or domain.

hosts allow = 192.168.56.   #define the network which you want to give the access.


# End of the file add these lines for shared the folder which you want

[share.folder]

path = /home/share.folder
writable = yes
create mode = 0777
directory mode = 0777

If your firewall is in running position then add rule for samba or stop firewall service, otherwise your service will not start or you will have issue in starting

[root@faraz fahmed]# firewall-cmd   --permanent  --add-service=samba
[root@faraz fahmed]# firewall-cmd   --reload

Start the service of samba.

[root@faraz fahmed]# systemctl start smb

Enable service at boot time.

[root@faraz fahmed]# systemctl enable smb

Add user for samba create new one or you can also manage the already exist user for samba. Here xyz user already exist I am going add to for samba.

[root@faraz fahmed]# smbpasswd   -a   xyz

Client-Side Windows PC

To access linux file share from windows client machine  press and hold start/windows+R button or click on start button and type run  in text field and dialog box will open . Then type the IP address of linux samba server and click ok.

run dialog box

Login window will  ask for username and password and click ok.

windows security credentials

Explorer will show the shared name of the folder/directory.

share folder on windows pc

 

I hope you enjoyed this article and now you can share data and file between different platform. In this tutorial we learnt how to make linux folder or directory shareable between linux server and windows client.Subscribe to  newsletter for upcoming and interesting articles/tutorials.

Thanks

SUBSCRIBE OUR NEWSLETTER
Join us by subscribing to our newsletter and learn IT subjects for free
We hate spam. Your email address will not be sold or shared with anyone else.

Leave a reply

You must be logged in to post a comment.