Linux Mount CIFS: Mounting Windows Shares on Linux

Try this guide with our instant dedicated server for as low as 40 Euros

Linux Mount CIFS_ Mounting Windows Shares on Linux

In a Windows environment, a shared folder (also known as Windows share or simply a share) refers to a folder on a Windows system that’s available to other computers on a network. It allows authorized users to access, alter, or retrieve the contents of a shared folder on other networked devices.

The Common Internet File System, or CIFS, is a network file-sharing protocol that enables Linux and other operating systems to access the shared Windows files and services.

In this tutorial, we will discuss the steps in the process of mounting CIFS shares in a Linux environment. The aim of the exercise is to allow users to access Windows shares from their Linux systems.

Mount CIFS Share in Linux 

Mounting a remote Windows share via CIFS is similar to mounting a regular file system.

The Prerequisites

Before mounting Windows shares on Linux, ensure you have the following:

  • A system running a mainstream Linux distribution.
  • A user account with root privileges and SSH access.
  • A shared drive or folder on a Windows system.

Step #1: Install the Linux CIFS Utilities Packages

Since the CIFS package is not often available on many Linux distributions. So, you need to install the CIFS utilities package before you can mount a Windows share on a Linux system.

The cifs-utils package provides the essential utilities for mounting SMB/CIFS shares on a Linux system. 

Let’s run through the steps required to install this package on the two popular Linux distribution families. 

Install cifs-utlis on Debian-based Systems

Start by updating the local package repository by running the following command:

# sudo apt update

Next, install the cifs-utils package:

# sudo apt install cifs-utils -y

sudo apt install cifs-utils -y

Install cifs-utlis on RHEL-based Systems

Update the system repository by running the following YUM command:

# yum update

Next, install the cifs-utils package:

# yum install cifs-utils

Install cifs-utlis on Fedora-based Systems

Start by updating the package repository:

# sudo dnf update

Install cifs-utils by running the following command in the terminal:

# sudo dnf install cifs-utils

Once the cifs-utils package is installed, the next step is to establish a mount point for the Windows share.

Step #2: Mount a Windows Share by Creating a Directory

Create a directory on the Linux machine. This directory serves as the mount point for the Windows Share. While you can create this directory anywhere you choose, the traditional location is the /mnt directory that contains the directories for mounted file systems and devices.

So, in this demonstration, we will create a directory called sharewin in the /mnt directory. For this, we will run the following command:

# sudo mkdir /mnt/sharewin

Step #3: Create the CIFS Windows Share Mount 

Once the directory is created, we will mount the Windows share by running this command: 

# sudo mount -t cifs //[IP_Address]/[share_name] /mnt/sharewin -o username=[username]


Replace [IP_Address], [share_name], and [username], with relevant information.

The command will ask for your password to initiate the process.

sudo mount -t cifs

After executing the command and mounting the share, you will be able to access the share from the /mnt/winshare directory on your Linux system. 

We recommend the cd command to navigate to the directory and then use ls to view the contents:


If you are unable to access the share, use the following command to check if it is mounted correctly and available in the filesystem list:

# df -h

df -h

The command outputs the mounted position of the remote Windows share on your Linux system.

Step #4: Configure the Windows Share to Mount Automatically On Boot (Optional)

You can automate the mounting process and avoid manual repetition of the mount process after every reboot.

Start by securing your login credentials in a different file. For this, create a new file named cifs-credentials with your favorite text editor. We will use nano for this demonstration:

username password

# sudo nano /etc/cifs-credentials

Add your login and password to the file:

# username=[username]

# password=[password]

Replace [password] and [username] with your credentials.

Save and exit the file.

Next, modify the file permissions to minimize access or changes to this file:

# sudo chmod 600 /etc/cifs-credentials

Next, edit the /etc/fstab file in your preferred text editor (we prefer Nano).

# sudo nano /etc/fstab

 Add the following line to the file:

//[IP_address]/[share_name] /mnt/winshare cifs credentials=/etc/cifs-credentials 0 0

Replace [IP_address] and [share_name] with your details.

Save and close the file. 

Your Windows share will now mount automatically when the system bootes.

How to Unmount CIFS Windows Share

Unmounting is an essential part of filesystem management on Linux systems. In order to ensure proper system operation, resource management, and data protection, we recommend unmounting CIFS Windows shares that are not in current use.

Use the following command to unmount the Windows share from your Linux system:

# sudo umount /mnt/winshare

Note that the command will delete the Windows share from the /mnt/winshare directory. 

Note: If you have mounted the Windows Share in a different directory, remember to provide the correct name to the command.

If an error arises when trying to unmount the share, the underlying issue can be the fact that a file could be in use or a user is accessing/utilizing the share.

In such cases, you can forcefully unmount the share by running the following command that uses the -f (–force) flag:

# sudo umount -f /mnt/winshare


Accessing resources hosted on Windows servers is made easier when Windows shares are mounted on Linux via CIFS. Users can interact with Windows shares just like they would with local folders by installing packages, setting up authentication, and creating mount points. 

CIFS guarantees effective data interchange between Linux and Windows environments by utilizing already-existing network infrastructure and protocols. All in all, it facilitates easier workflows and higher productivity by streamlining processes, enhancing accessibility to shared resources, and fostering cooperation across platforms.

For seamless access to your Windows shares on Linux and enhanced collaboration across platforms, choose Redswitches as your dedicated hosting provider.

At RedSwitches, we’re dedicated to helping you discover the perfect server solutions to drive your business to new heights. So, if you’re looking for a robust server, we offer the best-dedicated server pricing and deliver instant dedicated servers, usually on the same day the order gets approved. Whether you need a dedicated server, a traffic-friendly 10Gbps dedicated server, or a powerful bare metal server, we are your trusted hosting partner.

 Elevate your workflow efficiency today with Redswitches’ global hosting solutions.


Q. What is CIFS?

The networking protocol known as CIFS, or Common Internet File System, is mostly used on Windows-based computers to access network shares, files, and printers.

Q. What packages do I need to install to mount Windows shares on Linux via CIFS?

Typically, the cifs-utils package needs to be installed on a Linux system. You can use apt, yum, or zypper as your package manager to achieve this, depending on your distribution.

Q. How do I mount a Windows share on Linux using CIFS?

To mount the Windows share on your Linux system, first create a directory in that location. Next, utilize the mount command with the -t option to supply CIFS and all required parameters, including the mount point, Windows share path, and authentication information.

Q. What authentication methods can I use when mounting Windows shares via CIFS?

You can authenticate using various methods, such as username/password authentication or domain authentication, depending on your network setup and requirements.

Q. Can I automate the process of mounting Windows Share to Linux?

Yes, you can automate the mounting process by adding an entry to the /etc/fstab file on your Linux system. This allows the share to be automatically mounted at system startup.

Q. Are there any security considerations when mounting Windows shares on Linux via CIFS?

Yes, it’s essential to ensure secure authentication and transmission of data, especially if accessing sensitive information. Always use encrypted connections (such as using the sec=ntlm option) and ensure proper permissions are set on both the Windows share and the Linux mount point.

Q. Can I access Windows shares from Linux without using CIFS?

While CIFS is the most common method for accessing Windows shares on Linux, there are alternative methods such as using Samba, NFS (Network File System), or SSHFS (SSH File System), depending on your specific requirements and network setup.


Try this guide with our instant dedicated server for as low as 40 Euros