Activating Unix Core Server Database Directory Sharing
Samba share is one way for a Unix Core Server database to share data with an Open iT Analysis Server in a Windows environment. This guide will cover the steps to enable Samba share, allowing a Unix Core Server database directory to be shared with the Analysis Server.
This guide assumes that the user has root access on the machine where Samba sharing will be configured.
Installing Samba Service
The operating system used in this configuration is CentOS 8.4.
-
Check the machine if Samba is already installed:
Command Syntaxrpm -q samba
This command will either indicate that the Samba package is not installed on the machine or display the installed version of Samba.
Sample output if Samba is already installedsamba-4.13.3-5.el8_4.x86_64
-
If Samba is not yet installed in the machine, run the following command to install; otherwise, skip this step.
Command Syntaxyum install samba samba-client samba-common -y
Make sure that all packages are downloaded and the installation is completed successfully.
Enabling Samba Services through Firewall
-
Check if the firewall is enabled using the command below:
Command Syntaxfirewall-cmd --state
-
Enable Samba services using these commands:
Command Syntaxfirewall-cmd --permanent --zone=public --add-service=samba
-
Reload the firewall:
Command Syntaxfirewall-cmd --reload
Configuring Samba Sharing
Before configuring Samba, make sure that the Windows machine is in the same workgroup or domain as the CentOS/RHEL Core Server.
On the Windows machine, run this command and take note of the Workstation domain value in the output:
net config workstation
-
Go to the etc directory, which is by default in
/etc/samba/
, and back up thesmb.conf
configuration file. This configuration file is used by the Samba service.Command Syntaxsudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
-
Update
smb.conf
to set up shared folder. In this example, the database directory is in/var/data/database
.Configurations[global]
workgroup = svg
server string = Samba Server %v
netbios name = mnl510lin
security = user
map to guest = bad user
dns proxy = no
#============================ Share Definitions ==============================
[openit_data]
path = /var/data/database
browsable = yes
writable = yes
guest ok = yes
read only = noParameter Description workgroup The workgroup/domain of the Windows machine. netbios name The name of the Unix machine. path The path of the Core Server database set upon installation. writable If you need write access to the shared Core Server database directory, set the value to yes. Samba Share Configuration Parameters
-
Save the changes.
-
Verify the Samba settings by running the command:
Command Syntaxtestparm
-
Change the SELinux context for the Samba shared directory:
Command Syntaxchcon -vR -t samba_share_t /var/data/database
-
Enable and start the Samba services:
Command Syntaxsystemctl enable smb.service
systemctl enable nmb.serviceCommand Syntaxsystemctl start smb.service
systemctl start nmb.service -
Go to the Windows machine where the Analysis Server is installed and verify that the shared directory is visible. You may use the IP address of the Unix machine to access the database.
Verifying Samba Sharing
-
On the Analysis Server machine, follow the instructions in the Setting the Core Server File Database Location section. Use the configured Samba share directory as the value.
-
Run the SyncDatabase command.
-
Make sure the process finishes successfully. If the process fails, go back and review the steps above to double-check, or proceed with the Troubleshooting section.
Troubleshooting
Not visible subfolders
Problem
The subfolders in the data directory are not visible on the Windows machine.
Resolution
To resolve the issue, run the following command:
chcon -vR -t samba_share_t <data_dir_path>
Then, restart the Samba service.
Verify that the subfolders are now visible on the Windows machine.
chcon
can’t apply partial context to unlabeled file error
Problem
An error is encountered when running the chcon
command.
Resolution
To resolve ths error, run the following command to verify that SELinux is in enforcing mode:
getenforce
To set SELinux to enforcing mode, run the following command:
setenforce Enforcing