What Is SMB In Networking | Accessing Network Storage With SMB

Introduction:

Many organizations needs to provide network storage and print services for a range of desktop operating systems. Red Hat Enterprise Linux uses the Samba server to provide services that Microsoft Windows clients can use. Samba implements the Server Message Block(SMB) protocol, and Common Internet File System(CIFS) is a dialect of SMB. Often the two names are users interchangeably.

The basic steps for Accessing an SMB share:

1. Identify the remote share to access.

2. Determine a mount point where the share should be mounted and created the mount points empty directory.

3. Mount the network file system with an appropriate command or configuration change.

INSTALLING SAMBA ON LINUX REDHAT/CENTOS

To install Samba, you will need to become root with the following command (give the root password, when prompted):
$ su –      
Then use Yum to install the Linux Samba package:
# yum install samba
Before you begin to use or configure Samba, the Linux Firewall (iptables) has to be configured to allow Samba traffic. From the command-line, this is achieved with the use of the following command:
# firewall-cmd –enable –service=samba

CONFIGURING LINUX SAMBA

The Samba configuration is meant to join an RHEL, Fedora or CentOS system to a Windows Workgroup and setting up a directory on the RHEL system, to act as a shared resource that can be accessed by authenticated Windows users.

To start with, you must gain root privileges with (give the root password, when prompted):
$ su –
Edit the Samba configuration file:
# vi /etc/samba/smb.conf

THE SMB.CONF [GLOBAL] SECTION

sAn smb.conf file is divided into several sections. the [global] section, which is the first section, has settings that apply to the entire Samba configuration. However, settings in the other sections in the configuration file may override the global settings.
To begin with, set the workgroup, which by default is set as “MYGROUP”: workgroup = MYGROUP
Since most Windows networks are named WORKGROUP by default, the settings have to be changed as:
workgroup = workgroup

CONFIGURE THE SHARED RESOURCE

In the next step, a shared resource that will be accessible from the other systems on the Windows network has to be configured. This section has to be given a name by which it will be referred to when shared. For our example, let’s assume you would like share a directory on your Linux system located at /data/network-applications.  You’ll need to entitle the entire section as [NetApps] as shown below in our smb.conf file:

[NetApps]       
path = /data/network-applications
writeable = yes
browseable = yes valid users = administrator             
When a Windows user browses to the Linux Server, they’ll see a network share labeled
“NetApps”.  
This concludes the changes to the Samba configuration file.

CREATE A SAMBA USER

Any user wanting to access any Samba shared resource must be configured as a Samba User and assigned a password. This is achieved using the smbpasswd  command as a root user. Since you have defined “administrator” as the user who is entitled to access the “/data/network-applications” directory of the RHEL system, you have to add “administrator” as a Samba user.

You must gain root privileges with the following command (give the root password, when prompted):
$ su –
Add “administrator” as a Windows user –
# smbpasswd -a administrator
The system will respond with
New SMB password: <Enter password>
Retype new SMB password: <Retype password>
This will result into the following message:

Added user administrator

It will also be necessary to add the same account as a simple linux user, using the same password we used for the samba user:
# adduser administrator
# passwd administrator
Changing password for user administrator
New UNIX password: ********
Retype new UNIX password: ********
passwd: all authentication tokens updated successfully.
Now it is time to test the samba configuration file for any errors. For this you can use the command line tool “testparm” as root:
# testparm Load smb
config files from /etc/samba/smb.conf
Rlimit_max: rlimit_max (1024) below minimum Windows limit (16384)
Processing section “[NetApps]”
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

If you would like to ensure that Windows users are automatically authenticated to your Samba share, without prompting for a username/password, all that’s needed is to add the samba user and password exactly as you Windows clients usernames and password. When a Windows system accesses a Samba share, it will automatically try to log in using the same credentials as the user logged into the Windows system.

STARTING SAMBA AND NETBIOS NAME SERVICE ON RHEL

The Samba and NetBios Nameservice or NMB services have to be enabled and then started for them to take effect:
# systemctl enable smb.service
# systemctl start smb.service
# systemctl enable nmb.service # systemctl start nmb.service
In case the services were already running, you may have to restart them again:
# systemctl restart smb.service
# systemctl restart nmb.service

ACCESSING THE SAMBA SHARES FROM WINDOWS                               

Now that you have configured the Samba resources and the services are running, they can be tested for sharing from a Windows system. For this, open the Windows Explorer and navigate to the Network page. Windows should show the RHEL system. If you double-click on the RHEL icon, you will be prompted for the username and password. The username to be entered now is “administrator” with the password that was assigned.

Again, if you are logged on your Windows workstation using the same account and password as that of the Samba service (e.g Administrator), you will not be prompted for any authentication as the Windows  operating system will automatically authenticate to the RHEL Samba service using these credentials.

Leave a Reply

Your email address will not be published. Required fields are marked *