Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Linux connects to Samba and Windows file shares through the kernel’s cifs client and the mount.cifs helper. The helper is provided by the cifs-utils package.

This guide covers a temporary mount, secure credential storage, a persistent /etc/fstab mount, local ownership options, SMB protocol selection, and the errors that most often stop a mount from working. The examples use //server/share as the remote share and /mnt/share as the local directory.

1. Install the CIFS tools

Install cifs-utils before trying to mount the share. You normally also need root privileges, supplied with sudo.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
# Debian, Ubuntu, Linux Mint
sudo apt update
sudo apt install cifs-utils

# Fedora, RHEL, CentOS Stream
sudo dnf install cifs-utils

# Arch Linux
sudo pacman -S cifs-utils

The kernel must support the cifs filesystem. Most current general-purpose Linux distributions include that support. Confirm that the helper is available:

#1 Best Overall
Sale
UGREEN NAS DH2300 2-Bay for Beginners & Personal Users, Phone Backup | AI Album, Private Cloud/Remote Access, File Sharing, Multi-Device Backup, Home Entertainment, 4GB RAM on Board (Diskless)
  • Entry-level NAS Personal Storage:UGREEN NAS DH2300 is your first and best NAS made easy. It is designed for beginners who want a simple, private way to store videos, photos and personal files, which is intuitive for users moving from cloud storage or external drives and move away from scattered date across devices. This entry-level NAS 2-bay perfect for personal entertainment, photo storage, and easy data backup (doesn't support Docker or virtual machines).
  • Set Your Devices Free, Expand Your Digital World: This unified storage hub supports massive capacity up to 64TB.*Storage drives not included. Stop Deleting, Start Storing. You can store 22 million 3MB images, or 2 million 30MB songs, or 43K 1.5GB movies or 67 million 1MB documents! UGREEN NAS is a better way to free up storage across all your devices such as phones, computers, tablets and also does automatic backups across devices regardless of the operating system—Window, iOS, Android or macOS.
  • The Smarter Long-term Way to Store: Unlike cloud storage with recurring monthly fees, a UGREEN NAS enclosure requires only a one-time purchase for long-term use. For example, you only need to pay $459.98 for a NAS, while for cloud storage, you need to pay $719.88 per year, $2,159.64 for 3 years, $3,599.40 for 5 years. You will save $6,738.82 over 10 years with UGREEN NAS! *NAS cost based on DH2300 + 12TB HDD; cloud cost based on 12TB plan (e.g. $59.99/month).
  • Blazing Speed, Minimal Power: Equipped with a high-performance processor, 1GbE port, and 4GB RAM on Board, this NAS handles multiple tasks with ease. File transfers reach up to 125MB/s—a 1GB file takes only 8 seconds. Don't let slow clouds hold you back; they often need over 100 seconds for the same task. The difference is clear.
  • Let AI Better Organize Your Memories: UGREEN NAS uses AI to tag faces, locations, texts, and objects—so you can effortlessly find any photo by searching for who or what's in it in seconds. It also automatically finds and deletes similar or duplicate photo, backs up live photos and allows you to share them with your friends or family with just one tap. Everything stays effortlessly organized, powered by intelligent tagging and recognition.
command -v mount.cifs
mount.cifs --version

2. Create a local mount point

The local directory must exist before you mount the share:

sudo mkdir -p /mnt/share

You can choose another directory, such as /media/windowsshare or /srv/files. Do not mount over a directory that already contains files you need to access; the underlying files will be hidden until the share is unmounted.

3. Mount the share temporarily

For an authenticated share, use username= and let mount.cifs prompt for the password:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo mount -t cifs -o username=alice //server/share /mnt/share

The prompt normally looks like this:

Password for alice@//server/share:

The generic mount form and the dedicated helper are equivalent:

sudo mount -t cifs //server/share /mnt/share -o username=alice

# Equivalent form
sudo mount.cifs //server/share /mnt/share -o username=alice

Use the server’s hostname or IP address, the exact exported share name, and a local directory that exists. Avoid putting password=... directly in the command: it can remain in shell history and may be visible through process inspection.

Using a Windows domain or workgroup

Specify the domain separately rather than embedding it in the username:

sudo mount -t cifs 
  -o username=alice,domain=SALES 
  //server/share /mnt/share

domain=, dom=, and workgroup= are aliases. A Windows-style identity such as SALESsally means user sally in the SALES domain, so the Linux mount options should be username=sally,domain=SALES.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Mounting a guest share

If the Samba server explicitly permits unauthenticated guest access, use:

Rank #2
Sale
UGREEN NAS DXP2800 2-Bay for Advanced Home Users, Remote Workers & Creators | Home Media & Data Center, Docker & VM, Plex, Fast File Transfer, Intel N100, 8GB DDR5, 2.5GbE, 2x M.2 NVMe, 4K HDMI(Diskless)
  • 【Advanced Home Data & Media Hub】For advanced home users who need phone backup, file storage, and centralized data management. Centralize family photos, 4K videos, movies, computer backups, and personal files in one place while running multiple apps for home entertainment and everyday data management. Suitable for households with growing digital libraries and multiple NAS use cases.
  • 【Built for Creators, Media Servers & Advanced Apps】Powered by the Intel N100 Quad-Core CPU, 8GB DDR5 RAM, 2.5GbE networking, and dual M.2 NVMe slots, DXP2800 handles large files and heavier workloads with ease. Run Docker, virtual machines, and media server applications compatible with Plex—ideal for content creators, tech enthusiasts, and advanced home users managing 4K videos, RAW photos, personal media libraries, and multiple NAS apps.
  • 【Up to 80TB for Growing Digital Libraries】 Supports up to 80TB of storage using two HDD bays and two M.2 NVMe SSD slots for family photos, movies, RAW photos, 4K videos, work files, and device backups. AI photo management supports recognition of people, objects, scenes, and locations, album organization, and duplicate photo detection. HDDs and SSDs are not included.
  • 【AI-powered Home Surveillance】Turn DXP2800 into a centralized home surveillance hub by connecting compatible network cameras and storing recordings locally on your NAS. AI-powered features include Face Recognition, People Detection, and Pet Detection, helping advanced home users review important events more efficiently while managing home surveillance and personal data in one place.
  • 【One data Center Across Your Devices】Keep files from desktops, laptops, phones, tablets, and other devices together instead of scattered across cloud accounts and external drives. Access, back up, organize, and share data across Windows, macOS, Android, iOS, web browsers, and compatible smart TVs—ideal for creators and advanced home users working across multiple devices.
sudo mount -t cifs -o guest //server/share /mnt/share

guest suppresses the password prompt. It does not bypass the server’s access policy; a server that disallows guest access will still reject the mount.

4. Check that the mount worked

List the mounted files:

ls -l /mnt/share

Then inspect the active mount and negotiated options:

mount

Look for an entry similar to:

//server/share on /mnt/share type cifs (...)

When finished with a temporary mount, unmount it with:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo umount /mnt/share

A command-line mount is not automatically restored after a reboot. Use an /etc/fstab entry if the share should be available persistently.

5. Store credentials in a protected file

A credentials file is safer than putting a password in /etc/fstab or on a command line. Create one readable only by root:

sudo sh -c 'umask 077; cat > /root/smb.cred <<EOF
username=alice
password=secret
domain=SALES
EOF'
sudo chmod 600 /root/smb.cred

For a real system, replace the sample values. The file format is strict: do not put spaces around the equals sign.

# Correct
username=alice
password=secret

# Incorrect
password = secret

The optional domain= line can be omitted for a local Samba account. The format also supports password2=, which can be useful during password rotation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Mount with the file instead of exposing the password in the command:

Rank #3
Sale
UGREEN NAS DH4300 Plus 4-Bay for Beginners, Home Users & Remote Workers | Photo & Video Backup, AI Photo Album, File Hub, Private Cloud & Secure Home Surveillance, 8GB LPDDR4X, 4K HDMI (Diskless)
  • Entry-level NAS Home Storage: The UGREEN NAS DH4300 Plus is an entry-level 4-bay NAS that's ideal for home media and vast private storage you can access from anywhere and also supports Docker but not virtual machines. You can record, store, share happy moment with your families and friends, which is intuitive for users moving from cloud storage, or external drives to create your own private cloud, access files from any device.
  • Smart Photo Backup & AI Album: Automatically back up photos and videos from your phone in real time and keep growing family memories organized with AI-powered photo albums. Semantic search, custom learning, and recognition of people, objects, pets, and similar photos help you quickly find the moments you want. Duplicate photo removal also helps keep your library organized—ideal for families and users with large photo collections.
  • User-Friendly App & Easy Setup: Connect quickly via NFC, set up simply and share files fast on Windows, macOS, Android, iOS, web browsers, and smart TVs. You can access data remotely from any of your mixed devices. What's more, UGREEN NAS enclosure comes with beginner-friendly user manual and video instructions to ensure you can easily take full advantage of its features.
  • More Cost-effective Storage Solution: Unlike cloud storage with recurring monthly fees, A UGREEN NAS enclosure requires only a one-time purchase for long-term use. For example, you only need to pay $629.99 for a NAS, while for cloud storage, you need to pay $719.88 per year, $1,439.76 for 2 years, $2,159.64 for 3 years, $7,198.80 for 10 years. You will save $6,568.81 over 10 years with UGREEN NAS! *NAS cost based on DH4300 Plus + 12TB HDD; cloud cost based on 12TB plan (e.g. $59.99/month).
  • Your Data, You Control:No third-party clouds, no hidden access, UGREEN NAS provides a more secure and private data storage solution. It stores data locally on your private hard drives and does automatic backups. Thus, you can keep full control over it. The advanced encryption is TRUSTe certified in the United States and is awarded the first (and only) ETSI EN 303 645 certification mark for NAS products by TÜV SÜD Group.
sudo mount -t cifs 
  -o credentials=/root/smb.cred 
  //server/share /mnt/share

A password containing a comma is another reason to use a credentials file. CIFS mount options are comma-separated, so a comma supplied directly in password=... can be parsed as an option separator.

6. Make the mount persistent with /etc/fstab

Ensure the mount point and credentials file exist, then edit the filesystem table:

sudo mkdir -p /mnt/share
sudo editor /etc/fstab

Add this line:

//server/share /mnt/share cifs credentials=/root/smb.cred 0 0

Test the entry without rebooting:

sudo mount /mnt/share
ls -l /mnt/share
mount | grep ' /mnt/share '

When mount receives only the mount point, it finds the matching entry in /etc/fstab. If the test fails, fix the entry before rebooting.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Guest share in /etc/fstab

For a guest share, the entry can look like this:

//servername/sharename /media/windowsshare cifs guest,uid=1000 0 0

The uid=1000 option makes UID 1000 appear to own the files when the server does not provide Linux ownership information. Use the correct local UID for the user who needs access.

Share names containing spaces

Escape spaces in the remote path as 40 in /etc/fstab:

//server/My40Documents /mnt/share cifs guest 0 0

Avoid boot delays when the server may be offline

A network share can be unavailable while the machine is booting. If it should be mounted manually instead, add noauto:

//server/share /mnt/share cifs noauto,credentials=/root/smb.cred 0 0

Then mount it when needed:

sudo mount /mnt/share

7. Set local ownership and displayed permissions

CIFS may not receive Unix ownership information from the server. In that case, files can appear to be owned by root unless you specify local ownership options:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo mount -t cifs 
  -o credentials=/root/smb.cred,uid=1000,gid=1000,
file_mode=0660,dir_mode=0770 
  //server/share /mnt/share

You can use a username and group name instead of numeric IDs when supported:

Rank #4
BUFFALO LinkStation 210 2TB 1-Bay NAS Network Attached Storage with HDD Hard Drives Included NAS Storage that Works as Home Cloud or Network Storage Device for Home
  • Value NAS with RAID for centralized storage and backup for all your devices. Check out the LS 700 for enhanced features, cloud capabilities, macOS 26, and up to 7x faster performance than the LS 200.
  • Connect the LinkStation to your router and enjoy shared network storage for your devices. The NAS is compatible with Windows and macOS*, and Buffalo's US-based support is on-hand 24/7 for installation walkthroughs. *Only for macOS 15 (Sequoia) and earlier. For macOS 26, check out our LS 700 series.
  • Subscription-Free Personal Cloud – Store, back up, and manage all your videos, music, and photos and access them anytime without paying any monthly fees.
  • Storage Purpose-Built for Data Security – A NAS designed to keep your data safe, the LS200 features a closed system to reduce vulnerabilities from 3rd party apps and SSL encryption for secure file transfers.
  • Back Up Multiple Computers & Devices – NAS Navigator management utility and PC backup software included. NAS Navigator 2 for macOS 15 and earlier. You can set up automated backups of data on your computers.
sudo mount -t cifs 
  -o credentials=/root/smb.cred,uid=alice,gid=users 
  //server/share /mnt/share
Option Effect
uid= Local owner displayed for files and directories when server Unix ownership is unavailable.
gid= Local group displayed under the same conditions.
file_mode=0660 Displayed mode for files.
dir_mode=0770 Displayed mode for directories.

These options affect the Linux view of the mount. They do not override Samba share permissions, Windows ACLs, or the privileges of the SMB account in the credentials file. By default, one set of SMB credentials is used for access to the mounted share, so mounting as Alice does not make each local Linux user authenticate independently.

8. Use separate SMB credentials for different Linux users

For a multi-user mount, use multiuser with a non-interactive security mechanism such as sec=ntlmssp or sec=krb5. For example:

//server/share /mnt/share cifs multiuser,sec=ntlmssp,credentials=/root/smb.cred 0 0

Each user can add their server credentials to the kernel keyring:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
cifscreds add -u SMB_user_name server

The command prompts for that user’s password. multiuser cannot use a security mode that requires the kernel to interactively ask for a password during access, so configure a suitable non-interactive security mode.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

9. Choose an SMB protocol version only when necessary

Normally omit vers= and allow the client and server to negotiate a compatible dialect. Current CIFS clients do not request SMB1 by default, and SMB 2.1 or later is preferred.

Supported values commonly include:

vers=1.0
vers=2.0
vers=2.1
vers=3.0
vers=3.1.1

Only force a version when negotiation with a particular server requires it. For example:

sudo mount -t cifs -o vers=3.0,credentials=/root/smb.cred 
  //server/share /mnt/share

SMB1 is substantially less secure and should not be the default troubleshooting step. Use it only for a confirmed legacy device or a known CIFS UNIX-extensions requirement:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo mount -t cifs -o vers=1.0,username=alice 
  //server/share /mnt/share

For SMB-layer encryption, request SMB 3 or later with seal:

Best Value
Synology DS225+ Private Cloud Media Server - Stream, Back Up Photos & Share Files, Intel CPU for Hardware Transcoding (2-Bay Diskless NAS)
  • Your Personal Streaming Server - Build your own Netflix-style media library and stream 4K movies, shows and photos to any device without monthly fees
  • Create Your Own Cloud - Store your entire photo, video and music collection; access from anywhere with fast 282 MB/s transfer speeds
  • Creator-Grade Backup Solution - Protect your irreplaceable content with automated backups to cloud services, external drives and remote NAS
  • Multi-Layered Data Protection - Combine RAID redundancy, automated backups and snapshot technology to prevent data loss from any cause
  • Smart Home Surveillance - Support up to 30 IP cameras with AI detection, instant alerts and secure remote monitoring
sudo mount -t cifs 
  -o vers=3.0,seal,credentials=/root/smb.cred 
  //server/share /mnt/share

seal requires SMB 3.0 or later. Avoid insecure sec=ntlm; when NTLMv2 is required, sec=ntlmssp is the safer normal choice. sec=ntlmsspi additionally forces packet signing.

Common mount failures

Error or symptom What to check
mount error(13): Permission denied Check the username, password, domain or workgroup, server-side share permissions, and credentials-file formatting. In particular, remove spaces around =.
No such device or protocol negotiation failure The forced vers= value may not be supported by the server or client. First omit vers=; then try a confirmed compatible version such as 3.0 or 2.1.
Files appear owned by root Add appropriate uid=, gid=, file_mode=, and dir_mode= options when server Unix ownership is unavailable.
Mount works manually but boot is slow or fails The server was unavailable during boot. Use noauto if the share should be mounted on demand, or otherwise configure boot handling for network availability.
Guest mount prompts for a password or is denied The server does not permit guest access. The guest option prevents prompting but cannot grant unauthorized access.

Do not automatically solve authentication problems by forcing vers=1.0 or an old sec= value. Check the account and server policy first, then select a protocol version only if the server’s requirements are known.

Use current CIFS syntax

Use mount -t cifs or mount.cifs. Do not use the obsolete smbmount command. Also avoid deprecated credential forms such as user%password, workgroup/user, or workgroup/user%password. Use separate username=, password=, and domain= options, or preferably credentials=.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Prefer username= over the abbreviated user=; the latter can be interpreted specially by the generic mount program.

FAQ

What command mounts a Samba share in Linux?

Create a local directory and use the CIFS filesystem type: sudo mkdir -p /mnt/share, followed by sudo mount -t cifs -o username=alice //server/share /mnt/share. You will be prompted for Alice’s password.

How do I mount a Samba share automatically at boot?

Put the share in /etc/fstab, preferably using a protected credentials file: //server/share /mnt/share cifs credentials=/root/smb.cred 0 0. Test it with sudo mount /mnt/share before rebooting.

Why does my CIFS mount say permission denied?

The server rejected authentication or authorization. Check the username, password, domain, server-side share permissions, and the exact credentials-file syntax. Lines must use forms such as password=secret, without spaces around the equals sign.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Should I use vers=1.0 to fix a Samba mount?

Usually no. Omit vers= first and allow negotiation, or use SMB 2.1 or later when the server requires a specific dialect. SMB1 is less secure and should be limited to confirmed legacy requirements.

How do I stop a mounted Samba share?

Run sudo umount /mnt/share. If the mount is busy, close shells and applications currently using the directory, then retry.

The Bottom Line

For a one-time mount, use mount -t cifs with an interactive password prompt. For regular use, store the account in a root-only credentials file and reference it from /etc/fstab. Start with negotiated SMB settings, use uid= and gid= only to control the local view, and reserve SMB1 for genuinely legacy servers.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.