Linux Administrator

How To Configure Samba Server In Linux

Samba (SMB) is an open source and free software suite that runs on Linux/UNIX based system but it also communicate with Windows client like a native application. It is a file sharing server. It is used to share files between Windows and Linux/UNIX systems. Samba is able to provide this service by employing the common Internet File System (CIFS). The heart of CIFS is the Server Message Block (SMB).

In this article I am going to explain how you can configure SAMBA server in Linux  systems. Follow the below steps.

Step #1 . First you will need to create a directory where you want to keep data and share with other remote system such as Solaris,Windows, UNIX etc.

# mkdir /data

Step #2. Now you will need to install Samba server on system.

On RHEL/Fedora/CentOS

# yum install samba

On Ubuntu/Debian

$sudo apt-get install samba

Step #3. After installing samba server, configure it using it’s main configuration file “/etc/samba/smb.conf“.

# vim /etc/samba/smb.conf

workgroup = windows-group.

server string = Linux-Share

[sharedfolder]
comment = secured shared folder
path = /srv/samba/data
Valid users = sagar faeem
guest ok = no
writable = yes
privatable = no
browsable = yes

Save and exit

Where:

  • Workgroup : Where this server belongs. When windows user try to access any network resource they first try to access my network place and then search for workgroup then to server.
  • server string : Name of this samba server search, Here that name is Linux-Share.
  • [sharedfolder] : Share name, When any users access samba server through network this will be visible as folder shared.
  • comment : Use for any comment, which help to know what is this share for.
  • path : Location of shared folder, this is used to specific which folder you want to share.
  • valid users : Specifies which user is having access on this folder.
  • writable : Privide the access control to user whether users are able to write or not. In this example they can read and write.
  • privatable : It indecate whether this folder is private or not.
  • browsable : It is used to specify whether the folder content is browsable or not.

Step #4. Now create password for the users. So that users can access this samba share remotely.

#smbpasswd -a sagar
#smbpasswd -a faeem

Set the password for above users, password is stored in ” /etc/samba/smbpasswd ” file.

Step #5. Execute the below command for syntax check for smb.conf file.

# testparm

Step #6. Now restart samba service.

# service smb restart

Step #7. Keep on samba service on during booting time, samba service will start if server restarted.

#chkconfig smb on

I hope this article will help to configure samba server on Linux/UNIX systems. If you have any queries and problem please comment in comment section.

Thanks:)

Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

3 Comments

  • What do you when Linux stops seeing your NAS in the Windows Network? I’m using MX Linux 21 xFce and Samba was mounting my shares from my Lenovo NAS and now can’t find them. In the File Manager, under Windows Network, my NAS no longer shows up.

  • hi is this possible to access live centos server folder on local windows PC if it is possible please
    let me know this article is good so please tell me the procedure

    • Hi Ravindra,
      Thanks for reading my post. Yes you can also access your live centos server folder on your local PC with samba. Just follow the above steps and change the “path = /srv/samba/data” to your foder/directory like “path = /data” that’s it.

Leave a Comment