Last Updated on
Samba is a file sharing service which is based on SMB/CIFS network file sharing protocols. SMB, stands for Server Message Block, is a protocol for sharing files, printers, serial ports, and communications abstractions such as named pipes and mail slots between computers.
Samba primarily consists of two key programs plus few utilities. The two key programs are SMBD (Server Message Block Demon) and NMBD (NetBIOS Message Block Daemon). Main purpose of these two services is as follows:
- File & print services
- Authentication and Authorization
- Name resolution
- Service announcement (browsing)
Ephesoft’s SharedFolders are network shared folders which can be accessed from different Ephesoft nodes in Multi-Cluster. Hence on Linux Ephesoft uses Samba Share to make SharedFolders accessible over network as a file share.
This document describes steps to install and configure Samba Share such that Ephesoft’s SharedFolders can be accessible from different nodes in multi-server cluster.
Most of Linux systems already have a samba service installed on the system. But just in case if Samba service is not installed on the system it can be installed by following simple steps:
Samba Installation on REDHAT
- Make sure internet is available on the system.
- Make sure that user has proper permission to install software on the system.
To install software on REDHAT a user needs to have Super user permission thus in order to install Samba user must use root to install it.
yum install samba
Figure: Samba installation on REDHAT
- Add a user to samba and assign password to that user. Next step demonstrates method to add user to samba and assign samba password for that user. This process needs root permissions.
smbpasswd -a root
(-a is for adding user to samba and root is username to be added to samba)
Figure: Adding user to samba and assigning samba password for the user.
smbpasswd adds a user to samba and assigns samba password for the user. User will see error message if user does not exists on the Linux system.
Figure: Error adding user to samba as user does not exists on Linux machine.
- Testing samba demons smb and nmb. This requires root permission.
service smb restart
service nmb restart
Figure: Restarting smb and nmb
Samba shares can be configured through /etc/samba/smb.conf file which holds configuration details for samba server.
- Open smb.conf present inside /etc/samba/smb.conf using VI editor. Open file with root permissions as user may need to edit file.
- E.g. User wants to make SharedFolders present at /opt/Ephesoft/SharedFolders as shareable on samba share. User can do this by adding/appending following line to the end of smb.conf file. But before this user will need to give read, write, execute permission to everyone on the sharedfolders by executing following command (by default Ephesoft installer assigns rwx permission to everyone on SharedFolders):
chmod –R 777 /opt/Ephesoft/SharedFolders
Append following lines to end of smb.conf.
Figure: Share created with name ephesoft which point to /opt/Ephesoft/SharedFolders on machine
Details of parameters added to smb.conf
- Comment: comment for the shared folder.
- path : specifies the path of shared folder.
- browseable : allows to browse the files from file system.
- writeable : makes the shared folder writeable
- create mode : create files with group=rw permissions.
- directory mode : create dirs. with group=rw permissions.
- guest ok: allows guest access
- valid users : specifies list of valid users who can access the shared folder (users must be part of user-group assigned to the shared folder).
- Assign multiple users to list of valid users as one credential can be used by single machine at a time.
User will need to create the share with write, creation, readable and browseable permissions etc. The statements mentioned above make sure of the same.
- Save smb.conf file and restart smb and nmb demons by executing following commands.
service smb restart
service nmb restart
Figure: restarting samba smb/nmb demons
Now user can access this shared folder.
Figure: sharedfolders accessible on network
In order to setup SharedFolders on different Ephesoft nodes in multi-cluster setup user will need to mount the network share on a folder on every Ephesoft Linux node as Linux doesn’t unserstand network paths as windows does i.e. on windows network share can be directly access using \\ip –addr but on Linux it can be done using samba protocol which works in different manner.
Note: Installer will create a empty folder on same location on every Ephesoft node other than the node on which actual shared folder lies i.e. path of empty folder will be same as path of actual shared folder on machine where actual shared folders lies e.g. In above configuration where SharedFolder has been added to samba share the actual folder lies at /opt/Ephesoft/SharedFolders so empty folder will be created at same path on each machine using Ephesoft installer.
Now user will have to mount the network sharedfolders on each empty folders created by installer on each Ephesoft node.
User can mount the samba share over an empty folder by executing following command.
mount -t cifs -o user=root,password=root //<ip-addres>/ephesoft /opt/Ephesoft/SharedFolders
Here password is the password of smbuser for which smbpasswd was set.
Figure: mounting share on empty folder /opt/Ephesoft/SharedFolders
Figure: network shared folder mounted on empty folder on another Ephesoft node.
User will be able to access the mounted shared folder locally by accessing /opt/Ephesoft/SharedFolders as this folder is acting as mount point for network share. User will be able to create/modify files/folders locally on this path and changes will be reflected on the network share and on all the machines where this network share has been mounted.
Figure: User able to access the SharedFolder locally on mounted folder.
Figure: User creating folder on the mounted folder and these changes will be reflected on all the mount points and network share.
Figure: Changes of folder creation reflected on the network share.
Note*: Ephesoft META-INF properties file will contain the path of locally mounted folders and not the network path as Linux doesn’t understand the network share like windows do. Linux makes use of smb protocol to access the share folder. Hence user will have to mount network shared folders locally on their system such that Ephesoft is able to see data on same path on every system.