Skip to main content

Mount CIFS Share

Mounting a remote Windows share via CIFS is similar to mounting regular file systems. Follow the steps below to mount a CIFS share on Linux.

Step 1: Install CIFS Utilities Packages on Linux

The CIFS-Utils package provides the necessary utilities for mounting SMB/CIFS shares on a Linux system. The installation steps differ depending on which Linux distribution you are using.

For Debian-based systems:

First, update the local package repository to ensure the latest available package gets installed:

sudo apt update

Run the following command to install the CIFS-Utils package:

sudo apt install cifs-utils -y

For RHEL-based systems:

First, update the system repository:

yum update

Next, install the CIFS-Utils package by running the following command:

yum install cifs-utils

For Fedora:

Run the following command to update the package repository:

sudo dnf update

Install CIFS-Utils by running:

sudo dnf install cifs-utils

After the package installs, move on to the next section to create a mount point for the Windows share.

Step 2: Create a Directory to Mount Windows Share

To mount the Windows Share, create a directory on the Linux machine to act as a mount point for Windows Share. You can create this directory anywhere you want.

For this tutorial, we'll create a directory named winshare in the /mnt directory:

sudo mkdir /mnt/winshare

Step 3: Mount a CIFS Windows Share

After creating a directory, mount the Windows share. Use the following syntax:

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

Replace the [IP_Address], [share_name], and [username] with your details.

When prompted, enter your password and hit Enter.






After running the command and mounting the share, you should be able to access it from 

the /mnt/winshare directory on your Linux machine. 

Use the cd command to move to that directory and list the contents using ls




If you don't have access to the share, check if it is mounted correctly by running:

df -h 




If the share is correctly mounted, 

the output shows an entry for the remote Windows share 

and its mounted location on your Linux system.

Note: Check out our tutorial for mounting remote file systems over SSH.


Step 4: Make the Windows Share Automatically Mount at Boot

Make the Windows share mount automatically at boot to avoid mounting it after each system reboot. 

To do so, edit the /etc/fstab file using a Linux text editor. In this tutorial, we will use nano.

Follow the steps below:

1. Store your login credentials in a separate file for security reasons. Use this command to create a new file:

sudo nano /etc/cifs-credentials

2. Add your username and password to the file using the following format:

username=[username]

password=[password]

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

Save and close the file.

3. Change the file permissions to prevent unauthorized changes or access:

sudo chmod 600 /etc/cifs-credentials

4. Open the /etc/fstab file:

sudo nano /etc/fstab

5. Add the following line at the end of the file:

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

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

Save and close the file. Your Windows share will now automatically mount when the system boots.


How to Unmount CIFS Windows Share

Unmount the Windows share from your Linux machine with the umount command:

sudo umount /mnt/winshare

The command unmounts the Windows share from the /mnt/winshare directory. If you used a different directory as the mount point during setup, specify that directory in the command.

If errors arise when unmounting the share, it may be because a user is currently accessing the share or a file is open.

Force unmount the share by running the following command:

sudo umount -f /mnt/winshare

The -f (--force) flag force unmounts the share from your system.

Comments

Popular posts from this blog

Word to PDF Convertor

 A Word document may be easily converted to a PDF file However, what happens if you need to convert a ton of Word files into PDFs? It will take a long time to open every file by hand and save it to PDF.  You may quickly and easily convert large amounts of Word to PDF with the help of this method. And without utilizing any outside tools either. Ms. Word is all you need. Copy the following code into Notepad or Notepad++, then save the file as "PDF.js" in a folder var obj = new ActiveXObject("Scripting.FileSystemObject"); var docPath = WScript.Arguments(0); docPath = obj.GetAbsolutePathName(docPath); var pdfPath = docPath.replace(/\.doc[^.]*$/, ".pdf"); var objWord = null; try {     objWord = new ActiveXObject("Word.Application");     objWord.Visible = false;     var objDoc = objWord.Documents.Open(docPath);     var format = 17;     objDoc.SaveAs(pdfPath, format);     objDoc.Close();     WScript.Echo("Saving '" + docPath + "'

BACKUPPC INSTALLATION AND CONFIGURATIONS

BACKUPPC INSTALLATION AND CONFIGURATIONS BackupPC is a backup solution that can be configured to back up remote Linux and Windows systems. It can use a variety of different protocols and has a flexible scheduler to coordinate full and incremental backups. I have installed this on ubutnu 14.04 LTS and its running fine for me for a long time since the installation Open a terminal and enter the following commands: sudo apt-get update sudo apt-get install backuppc During the installation, you will be asked what kind of mail server configuration is needed. We can select the "Local only" option, because we will not be configuring internet-aware mail ???????? Postfix Configuration ????????? ? General type of mail configuration: ? ? ? ? No configuration ? ? Internet Site ? ? Internet wi

Flash For EVONY 2021

Flash is now officially dead.   with this way you can still use Flash. if you have any problem while installing or working on this please feel free to contact me to help you first we have to go to pale moon https://www.palemoon.org/ Download and install PaleMoon then lets go to adobe archive page  https://web.archive.org/web/20200630185339/https://helpx.adobe.com/flash-player/kb/archived-flash-player-versions.html go to bottom of the page until you find the  Flash Player archives this site is little bit slower than others  Download this version,after May it is not working (Released 5/12/2020)  Flash Player 32.0.0.371  (425 MB)    https://web.archive.org/web/20200630185339/https://fpdownload.macromedia.com/pub/flashplayer/installers/archive/fp_32.0.0.371_archive.zip Unzip the archive and install the flash player for windows, Goto control panel and find the flash adon there Click on never check for updates  then open your c drive  and search where adobe is get installed. in here i am usi