# 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.

# Installing Samba Service

The operating system used in this configuration is CentOS 8.4.

  1. Check the machine if Samba is already installed:

    Command Syntax
    rpm -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 installed
    samba-4.13.3-5.el8_4.x86_64
  2. If Samba is not yet installed in the machine, run the following command to install; otherwise, skip this step.

    Command Syntax
    yum 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

  1. Check if the firewall is enabled using the command below:

    Command Syntax
    firewall-cmd --state
  2. Enable Samba services using these commands:

    Command Syntax
    firewall-cmd --permanent --zone=public --add-service=samba
  3. Reload the firewall:

    Command Syntax
    firewall-cmd --reload

# Configuring Samba Sharing

  1. Go to the etc directory, which is by default in /etc/samba/, and back up the smb.conf configuration file. This configuration file is used by the Samba service.

    Command Syntax
    sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
  2. 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 = no
    Parameter 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

  3. Save the changes.

  4. Verify the Samba settings by running the command:

    Command Syntax
    testparm
  5. Change the SELinux context for the Samba shared directory:

    Command Syntax
    chcon -vR -t samba_share_t /var/data/database
  6. Enable and start the Samba services:

    Command Syntax
    systemctl enable smb.service
    systemctl enable nmb.service
    Command Syntax
    systemctl start smb.service
    systemctl start nmb.service
  7. 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

  1. 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.

  2. Run the SyncDatabase command.

  3. 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:

Command Syntax
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:

Command Syntax
getenforce

To set SELinux to enforcing mode, run the following command:

Command Syntax
setenforce Enforcing

We value your feedback!

Please take a few minutes to complete our survey and share your thoughts on your recent experience with our documentation.

Take survey

Close