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 Ubuntu
- 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 Ubuntu a user needs to have Super user permission thus in order to install Samba user must use sudo to install it.
sudo apt-get update
sudo apt-get install samba
Figure: Samba installation on ubuntu
- 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 sudo permissions.
sudo smbpasswd -a turbo
(-a is for adding user to samba and turbo 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 smbd and nmbd. This requires sudo permission.
sudo service smbd restart
sudo service nmbd restart
Figure: Restarting smbd and nmbd
Samba shares can be configured through /etc/samba/smb.conf file which holds configuration details for samba server.
1. Open smb.conf present inside /etc/samba/smb.conf using VI editor. Open file with sudo permissions as user may need to edit file.
sudo vi /etc/samba/smb.conf
2. E.g. User wants to make SharedFolders present at /home/turbo/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):
sudo chmod –R 777 /home/turbo/Ephesoft/SharedFolders
Append following lines to end of smb.conf.
Figure: Share created with name ephesoft which point to /home/turbo/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 browse able permissions etc. The statements mentioned above make sure of the same.
3. Save smb.conf file and restart smbd and nmbd demons by executing following commands.
sudo service smbd restart
sudo service nmbd restart
Figure: restarting samba smbd/nmbd 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 /home/turbo/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.
sudo mount -t cifs -o user=turbo,password=Passw0rd //192.168.108.21/ephesoft /home/turbo/Ephesoft/SharedFolders
Here password is the password of smbuser for which smbpasswd was set.
Figure: mounting share on empty folder /home/turbo/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 /home/turbo/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.