• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
NameHero® Blog

NameHero® Blog

Web Hosting Tips & Resources From NameHero

  • Hosting
    • Web Hosting
    • WordPress Hosting
    • WooCommerce Hosting
    • Enterprise Hosting
  • VPS
    • VPS Hosting
    • Flex VPS
  • Reseller
  • Email
  • Gaming
  • Domains
  • Website Builder
  • Account
  • Blog Home
  • Categories
  • Authors

How To Mount CIFS/SMB Shares On Linux

CJ Saathoff

Published on: June 25, 2024

Categories: Linux Command Line 0

In this blog post, we are going to take a look at how to mount SMB shares on Linux. From the related terms, to what needs to be installed, and how to mount it to your local file system. Then wrapping up with troubleshooting and unmounting.

  • What Is CIFS?
  • What Is SMB?
  • Why SMB?
  • Install CIFS Utilities Packages On Linux
    • What SMB Version Should I Use?
  • Create A Directory To Mount The Share
  • Mounting From The Command Line
  • Auto Mounting
  • Troubleshooting
  • How To Unmount The Share
  • Conclusion

What Is CIFS?

CIFS stands for common internet file system, it’s a dialect of the SMB protocol.

What Is SMB?

SMB or server message block is a protocol used to share files, printers, and more. Most think of Microsoft created SMB because of its use in Windows, but it was created by Barry Feigenbaum at IBM. The way it was built allows for protocol extensions. Microsoft has written the most extensions to the protocol.

Why SMB?

Popularity, most operating systems including Windows, macOS, Linux, and Unix support the SMB protocol.

Install CIFS Utilities Packages On Linux

Although we will be connecting using SMB the package name for the user space tools for SMB is called cifs-utils. This is a package created by the samba.org team who you might be surprised to know has been working with SMB before Microsoft implemented it in Windows NT.

To install on Debian/Ubuntu

sudo apt install cifs-utils

To install on RPM systems using DNF

sudo dnf install cifs-utils

What SMB Version Should I Use?

It’s recommended to use the latest version supported by the server and client.

Assuming you are running modern operating systems, you are likely to at least have support for SMB 3.0. You may need to refer to documentation or the internet to confirm what SMB versions are supported.

The supported version of SMB on Linux will depend on your Linux kernel version, for SMB3 kernel 3.12+ is needed (or a backport of cifs.ko at or above version 2.02).

Create A Directory To Mount The Share

Before we can get started you will need to need an empty directory that you will mount the share to this is represented as /path/to/mount/point below.

If you need to create this here is an example command.

sudo mkdir /mnt/smb-share

Feel free to change the path for your needs.

Mounting From The Command Line

To mount from the command line this is what the syntax of the command will look like.

sudo mount -t cifs -o vers=X,username=user //[IP/hostname]/path/to/share /path/to/mount/point
  1. First, replace X with the version of SMB you want to use, see the options listed below:
    • 1
    • 2.0
    • 2.1
    • 3.0
    • 3.11 (Version 3.1.1)
  2. Then replace the user with the correct username.
  3. Replace [IP/hostname] with the IP or hostname of the system you want to connect to using SMB.
  4. Replace the /path/to/share, this is the path to the share on the SMB server.
  5. Finally, replace /path/to/mount/point with a path to a blank folder (you may need to create this folder using mkdir) to which the share can be mounted.

After running the command you will be prompted for the password.

Auto Mounting

If you would like to mount the share on boot, you will need to add a line to /etc/fstab.

Be aware that regular users may have permission to view this file so you don’t want to have login credentials in this file. Instead, you will want to create a credentials file as shown below.

Creating the credentials file

I recommend creating the file with a unique name in case you need to mount more than one share.

sudo nano /etc/SMB-credentials-[unique-identifier]

Add this to the file

username=
password=

Append the username and password before saving and exiting out of nano (or your text editor of choice).

Now this is what you will need to add to /etc/fstab.

//[IP/hostname]/path/to/share  /path/to/mount/point  cifs  credentials=/etc/SMB-credentials-[unique-identifier],vers=X 0       0
  1. First, replace X with the version of SMB you want to use. This will be one of the options below
    • 1
    • 2.0
    • 2.1
    • 3.0
    • 3.11 (Version 3.1.1)
  2. Replace [IP/hostname] with the IP or hostname of the system you want to connect to using SMB.
  3. Replace the /path/to/share this is the path to the share on the SMB server.
  4. Finally, replace /path/to/mount/point with a path to a blank folder () to which the share can be mounted.

To test mounting use mount -a to confirm if it will mount.

Troubleshooting

If you’re running into issues check the following:

  • Check the IP, username, password, SMB version, and paths.
  • Can you reach the server from the client?
  • Are there any firewalls in the way (this includes hardware and software firewalls)?
  • Use journalctl -kr if you get an error code to see the full message. 

How To Unmount The Share

  • To unmount the share temporally use:umount [mount_point]
  • To unmount permanently (even after rebooting) remove from /etc/fstab and then use the umount command above.

Note: If you run into issues unmounting remove from /etc/fstab and restart instead.

Conclusion

In this blog post, we have resolved the misconception that CIFS are different from. From there we discussed the related terms, to what needs to be installed, and how to mount it to your local file system. Wrapping up with troubleshooting and unmounting.

CJ Saathoff

Embracing a lifelong passion for technology since childhood, CJ delved into the intricate workings of systems, captivated by the desire to understand the unknown. This innate curiosity led to his discovery of Linux, a revelation that resonated deeply. With more than 7 years of on the job experience, he’s honed his technical skills as a Geek and Senior Linux Systems Administrator.

Related Posts

Linux tr Command: Everything You Need To Know

Let's cover the basics of the tr command in Linux as well as some use cases to help you get started utilizing the command.

Unlocking The Power Of The Linux Alias Command

Check out our guide for everything you need to know about the Linux Alias command - from beginner information to advanced techniques!

Keeping Your Linux System Up-to-date With APT

Check out our beginner friendly guide where we will discuss how to keep your Ubuntu, Debian, and derivatives up to date with the apt command. 

Neovim vs. Vim: What’s The Difference?

Neovim is a new text editor developed in 2014, and it comes with a bunch of improvements over vim. But do you really need to switch?

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow & Subscribe

Exclusive promos, content and more!


Most Popular Posts

NameHero’s Recommended WordPress Plugin and Theme Setup (2024)

WordPress Hosting vs. Web Hosting – What’s The Difference?

How To Increase The InnoDB Buffer Pool Size

How To Fix A Stuck All-in-One WP Migration Import

How To Add A Subdomain In Cloudflare

Top Categories

  • WordPress
  • WordPress Tutorials
  • Enterprise Hosting
  • WooCommerce
  • Web Hosting
  • Resellers
  • Website Security
  • Website Development
  • Website Performance
  • VPS Hosting
  • SEO Tips
  • Announcements
  • Domain Registration
NameHero

NameHero® proudly provides web hosting to over 40,000 customers with 99.9% uptime to over 750,000 websites.

  • Master Card
  • Visa
  • American Express
  • Discover
  • Paypal
Products
  • Web Hosting
  • VPS Hosting
  • Flex VPS Hosting
  • WordPress Hosting
  • WooCommerce Hosting
  • Reseller Hosting
  • Enterprise Hosting
  • Email Hosting
  • Game Hosting
  • Domains
  • Website Builder
Help & Support
  • NameHero Blog
  • NameHero Gaming Blog
  • Support
  • Help Center
  • Migrations
  • Affiliates
  • Gaming Affiliates
  • Call 1-855-984-6263
Company
  • About Us
  • Contact Sales
  • Reviews
  • Uptime
  • We're Hiring

Copyright © 2025 Name Hero, LLC. All rights reserved.
NameHero® is a registered trademark.

  • Privacy Policy
  • Terms of Use
  • Acceptable Use Policy
  • Payment Policy
  • DMCA