Mounting an on-premise Windows CIFS Share to an Oracle Linux 8 VM in OCI

Introduction

In today’s interconnected world, it’s common to have a need to share files between different operating systems. Oracle Linux 8, running on a virtual machine (VM) in Oracle Cloud Infrastructure (OCI), allows you to mount a Windows CIFS (Common Internet File System) share for seamless file sharing. This article provides a detailed, step-by-step guide to help you accomplish this task.

Prerequisites:

Before you begin, ensure that you have the following:

  • An Oracle Linux 8 VM running in Oracle Cloud Infrastructure (OCI).
  • Access to a Windows machine hosting the CIFS share.
  • Administrative privileges on both the Windows machine and the Oracle Linux 8 VM.

Firewall prerequisites:

Windows Firewall:

On the Windows machine hosting the CIFS share, ensure that TCP port 445 is open in the Windows Firewall. This port is used by the Server Message Block (SMB) protocol, which is the underlying protocol for CIFS.

Oracle Linux 8 VM Firewall (OCI Security List):

In the OCI Console, navigate to the Networking section and locate the Security List associated with your Oracle Linux 8 VM.
Add an Ingress rule to allow inbound traffic on TCP port 445 from the Windows machine’s IP address or a broader range, depending on your security requirements.

Step 1: Install Required Packages

SSH into your Oracle Linux 8 VM.
Execute the following command to install the necessary packages:

sudo dnf install cifs-utils -y

Step 2: Create a Mount Point

Determine the directory on your Oracle Linux 8 VM where you want to mount the CIFS share. For example, let’s use “/mnt/cifs” as the mount point.
Execute the following command to create the mount point directory:

sudo mkdir /mnt/cifs

Step 3: Obtain Windows CIFS Share Details

  • On your Windows machine, navigate to the folder you wish to share.
  • Right-click on the folder, select “Properties,” and go to the “Sharing” tab.
  • Note down the following details:
    • The Windows machine’s IP address or hostname.
    • The shared folder name.
    • The Windows username and password with appropriate access to the shared folder.

Step 4: Mount the CIFS Share

On your Oracle Linux 8 VM, execute the following command to mount the CIFS share:

Replace the placeholders (“<…>”) with the appropriate values obtained in Step 3.
For example:

sudo mount -t cifs <IP Address/shared_folder> /mnt/cifs -o username=john,password=pass123

Step 5: Verify the Mount

Execute the following command to list the contents of the mounted CIFS share:

ls /mnt/cifs

If the command displays the contents of the shared folder, the mount was successful.
Step 6: Configure Mount on Boot (Optional)

If you want the CIFS share to be mounted automatically on VM boot, open the “/etc/fstab” file using a text editor:

sudo nano /etc/fstab

Add the following line at the end of the file:

/// /mnt/cifs cifs username=,password= 0 0

Save the changes and exit the text editor.

Conclusion

By following these step-by-step instructions, you can easily mount a Windows CIFS share to an Oracle Linux 8 VM running in Oracle Cloud Infrastructure. This enables seamless file sharing and collaboration between Windows and Linux environments, making it easier.

Leave a comment