Install & Configure Samba Server on Linux (RHEL7 / CentOS7)

configure samba Server on RHEL7, configure samba server on linux, How to configure samba server, install samba server in centos7, samba server configuration

This Tutorial describes you the Step by Step procedure to install and configure the SAMBA server and client on Linux (RHEL7/CentOS7).

Topics involved:
What is Samba?
Uses of Samba?
Samba requirements
How to install the Samba server packages?
How to configure Samba server?
How to start the samba service?
How to add a user to samba?
How to verify the samba share access?

Install & Configure Samba Server on Linux

What is Samba?

Samba provides a stable and highly compatible file and print sharing service that allows a Linux node to act as a client, a member server, or even a Primary Domain Controller (PDC) or a member of an Active Directory (AD) service on Microsoft-based networks. Samba interacts with Microsoft's CIFS built on the Server Message Block (SMB) protocol.

Uses of Samba?

1. As a File Server like NFS to share the files but across OS (linux to windows).
2. As a WINS [Windows Internet Name Server] or NBNS server
3. As a PDC [SAM - Security Access Module]
4. As a Print Server using CUPS

Samba details

Package : samba*
Port no : 137,138,139
Script : /etc/init.d/smb
Service name : smb
Daemon : smbd
Configuration file : /etc/samba/smb.conf

Use the following instructions to install and configure the SAMBA Server and Client on Linux (Centos7/RHEL7).

Lab Setup:
RHEL7 or CentOS7 installed server - 2 Nos.
Network enabled
Firewall and selinux are disabled
Hostnames : linux1 (server) and linux2 (client)

Prerequisites:
1. Make sure both server Linux1(192.168.2.61) and client(192.168.2.62) are reachable.
2. Make an entry of each host in /etc/hosts for name resolution or Configure it in DNS to resolve the IP, if you use server name instead of IP address. Read also how to configure DNS Server on RHEL7 But we use IP Address for in this article.

Server end configuration

Login into the server Linux1 (192.168.2.61) and do the following steps to install and configure Samba Server.
[ads-post]
Install the Samba server packages

Install the appropriate Samba packages "samba*" using yum to avoid dependencies issue. if yum is not configured, please refer the link Yum Configuration on Linux.
[root@linux1 ~]# yum -y install samba*
Configure the Samba server

Samba server main configuration file name is smb.conf which is located in /etc/samba/. It has many directives which can be used for each purpose.

Assume that, we are going to configure the samba server to share the /mnt directory. Lets edit the main configuration file.

[root@linux1 ~]# vi /etc/samba/smb.conf
Just go to the last line and append the below entries into the file.
[mnt]
comment = Samba test share
path = /mnt
Note : By default samba doesn't allow to write any data. If you want the share to be write-able mode, add the below directive as "yes" and change the file permission (chmod 777 /mnt) to write-able. If file permission is not set to write, samba will allow to write the data, but linux file permission wont allow to write, so you will face an issue as permission denied.
writeable = yes
Finally it should looks like below
[mnt]
comment = Samba test share
path = /mnt
writeable = yes
Verify the configuration file
Always after changing the configuration file, use the command "testparm" to check the changes for any syntax errors.
[root@linux1 ~]# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[mnt]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
# Global parameters
[global]
        workgroup = MYGROUP
        server string = Samba Server Version %v
        security = USER
        log file = /var/log/samba/log.%m
        max log size = 50
        idmap config * : backend = tdb
[homes]
        comment = Home Directories
        read only = No
        browseable = No
[mnt]
        comment = Samba test share
        path = /mnt
        read only = No
If you dont have any syntax errors, you will get the output as "Loaded services file OK." If you get error as unknown parameter, please use the correct word.

Enable and Start the Samba service
[root@linux1 ~]# systemctl start smb
[root@linux1 ~]# systemctl enable smb
Ensure the samba port listening or not.
[root@linux1 ~]# netstat -lt | grep netbios
Add a valid linux user to samba

Samba need a additional password to provide the access as well as that user should be a valid linux user, which means user should be exist in the server. if not, create a new user using useradd command and add the user to the samba as below. It will prompt to enter the additional new password specially for samba.
[root@linux1 ~]# smbpasswd -a user1
New SMB password:
Retype new SMB password:
Added user user1.
Verify the access locally and remotely

Always first check the access locally and finally check from client end. It will be easy to troubleshoot where the problem exists when the problem occurs to access the samba shares locally or over the network.

Verify the access from samba server end
Use the below samba client utility (smbclient) in which specify the samba server address (-L 192.168.2.61) and user (-U user1). It will prompt to enter the password of the user added to the samba.
[root@linux1 ~]# smbclient -L 192.168.2.61 -U user1
Enter user1's password:
Domain=[MYGROUP] OS=[Windows 6.1] Server=[Samba 4.2.10]
        Sharename       Type      Comment
        ---------       ----      -------
        mnt             Disk      Samba test share
        IPC$            IPC       IPC Service (Samba Server Version 4.2.10)
        user1           Disk      Home Directories
Domain=[MYGROUP] OS=[Windows 6.1] Server=[Samba 4.2.10]
        Server               Comment
        ---------            -------
        Workgroup            Master
        ---------            -------
        WORKGROUP            LEARNITGUIDE
If we get the output as above, then we can access the samba server successfully.

Verify the access from samba client
Execute the same command from the client to ensure the same is working from network also. We should get the same output as we got locally.
[root@linux2 ~]# smbclient -L 192.168.2.61 -U user1
That's all the installation and configuration of Samba server on Linux (RHEL7 / CentOS7).

Thanks for reading our post. share with your friends. We appreciate your feedback, Leave your comments if any.
We have more articles to be updated soon. To not miss any updates, Follow us on social networking sites @Learnitguide and Subscribe us on our Youtube channel @Learnitguidenetblog. configure samba Server on RHEL7/Centos7, linux samba server setup, Linux samba configuration, samba server configuration, Step by step samba Configuration, install samba server in centos7, samba server configuration, samba client configuration, samba installation and configuration, samba server configuration in linux, samba configuration in linux, linux samba server configuration, samba configuration linux, samba server installation and configuration in linux, samba configuration in linux step by step, samba client configuration in linux, linux samba configuration, samba configuration example, redhat samba configuration, samba server configuration in ubuntu step by step, samba server linux, samba in linux, linux samba, samba configuration in linux, samba server configuration in linux, samba linux server, how to configure samba server in linux, what is samba in linux, samba on linux, linux samba server, samba tutorial linux, linux samba configuration, samba server for linux, linux samba tutorial, samba linux, linux samba tutorial for beginners, samba server configuration on rhel7, samba server configuration on centos7
August 14, 2016

Post a Comment

[disqus][facebook][blogger]

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget