Technical Anshu Home › Tutorials › Mount Windows Share in Ubuntu
🐧 Ubuntu + Windows Share

Mount Windows Share in Ubuntu - Permanent Setup

Connect to a Windows shared folder from Ubuntu once, the manual way, and it vanishes at the next reboot. This setup mounts the share permanently with cifs-utils and an fstab entry — with the Windows password kept in a protected credentials file, _netdev and nofail so boot never hangs, and uid/gid so the files belong to you.

✍️ Technical Anshu🐧 Ubuntu🎧 Multi-Language Audio
Mount Windows Share in Ubuntu - Permanent Setup
🎧 Multi-Language Audio: In the video player, click [Settings] (⚙️) ➔ [Audio track] to select your preferred audio.

📑Chapters

  1. The problem — a share you open by hand disappears after every reboot
  2. Quick test — open the share once from the Files app
  3. Install the cifs-utils package
  4. Create the mount point at /mnt/SharedDocs
  5. Save the Windows login in a protected credentials file
  6. Add the permanent entry to /etc/fstab, with _netdev and nofail
  7. Mount it now, verify it, then do the reboot test

📋 Overview & Step-by-Step Guide

1

Test the Share First from the Files App

Before making anything permanent, prove the basics once: the Windows PC is sharing the folder, the network path works, and your Windows username and password are accepted. Open the Files app, press Ctrl + L to open the location bar, and type the share address — in the video it is the SharedDocs folder on the PC named OFFICE-PC:

Files — Location Bar
smb://OFFICE-PC/SharedDocs

Enter the Windows username and password when asked. If the folder opens and you can see its files, the share name, the PC name and the login are all correct — write them down exactly, because the permanent setup uses the same three things. Replace OFFICE-PC and SharedDocs with your own PC name and share name throughout this guide.

✅ If the name does not resolve, the same test works with the Windows PC's IP address instead, for example smb://192.168.1.10/SharedDocs. Give the Windows PC a fixed or reserved IP address — a permanent mount is only as reliable as the address it points to.
2

Install cifs-utils

A permanent mount needs the CIFS tools — the mount.cifs helper that lets Ubuntu attach an SMB (Windows) share as a normal folder. Open a terminal and install the package:

Terminal
sudo apt update
Terminal
sudo apt install cifs-utils

Without this package, the fstab entry in Step 5 has nothing to work with and the mount fails — this small install is what separates a one-time browse from a real, boot-time mount.

3

Create the Mount Point

A mount point is simply an empty folder where the share's contents will appear. Create one under /mnt, named after the share:

Terminal
sudo mkdir -p /mnt/SharedDocs

Leave this folder empty. When the share is mounted, everything inside /mnt/SharedDocs is really the files on the Windows PC — and when it is not mounted, the folder is just empty, which is also a useful way to tell at a glance whether the mount is live.

4

Store the Login in a Protected Credentials File

The mount needs your Windows password at every boot, but that password must never sit inside /etc/fstab itself — fstab can be read by every user account on the machine. Instead, keep the login in its own small file that only root can read. Create it:

Terminal
sudo nano /root/.smbcredentials

Type exactly two lines, with your own Windows username and password, then save with Ctrl + O and exit with Ctrl + X:

/root/.smbcredentials — file contents
username=YourWindowsUser
password=YourWindowsPassword

Now lock the file down so only root can read it:

Terminal
sudo chmod 600 /root/.smbcredentials
⚠️ The chmod 600 is the whole point of this step, not an optional extra. Without it, the credentials file is just your Windows password written in plain text where other accounts on the PC can read it. And remember for later: if you ever change the Windows password, update this file too — a stale password here is the most common reason a working mount suddenly stops.
5

Add the Permanent fstab Entry

Now tell Ubuntu to mount the share at every boot. First keep a backup copy of the original fstab — one wrong line in this file can affect booting, and the backup is your way back. Then open the file:

Terminal
sudo nano /etc/fstab

Add this single line at the very end of the file:

/etc/fstab — add this line
//OFFICE-PC/SharedDocs /mnt/SharedDocs cifs credentials=/root/.smbcredentials,iocharset=utf8,_netdev,nofail,uid=1000,gid=1000 0 0

What each part does: //OFFICE-PC/SharedDocs is the share, /mnt/SharedDocs is where it appears, and cifs is the filesystem type. credentials= points to the protected file from Step 4, so no password appears in fstab. iocharset=utf8 keeps file names with special characters correct. _netdev tells the system this mount needs the network, so it waits for the network instead of failing too early. nofail means that if the Windows PC is switched off, Ubuntu still boots normally instead of hanging or dropping to an emergency prompt. uid=1000,gid=1000 makes the mounted files owned by your Ubuntu user, so your apps can save into the share without sudo — 1000 is the first user account's usual ID; check your own with the id command and adjust if yours differs.

📌 Leave the SMB version out of the line. Ubuntu and any modern Windows negotiate SMB 3 automatically, which is the secure default. Only an ancient device that supports nothing newer would ever need an old version forced — avoid that unless you truly have no choice, because SMB1 is insecure and deprecated.
6

Mount Now and Verify Before You Reboot

Do not reboot yet. Test the fstab entry right now, while you can still see any error it produces:

Terminal
sudo mount -a

mount -a mounts everything listed in fstab. If it finishes silently, the entry is good — open /mnt/SharedDocs and you should see the Windows share's files, and a quick df -h shows the share listed as a mounted filesystem. Create a small test file inside it to prove you can write, not just read. Only after this test passes, reboot the Ubuntu machine once: the share should be back in place on its own, with no manual connection — that reboot is the real proof the permanent setup works.

✅ If mount -a reports an error, fix it now rather than after a reboot — read the message, because it usually names the problem directly: a wrong share name or PC address, wrong contents in the credentials file, or "permission denied" from the Windows side, where the user needs permission on both the Sharing tab and the Security tab of the folder. A mount rarely breaks on its own later; when one does, something changed on one side — the Windows password, the PC's address, or the permissions.

🏷️Topic Search Variables & Keywords

🔍 CIFS 🔍 cifs-utils 🔍 fstab 🔍 SMB 🔍 mount.cifs 🔍 Ubuntu 🔍 TechnicalAnshu 🔍 Mount Windows Share in Ubuntu 🔍 Permanent Mount 🔍 Credentials File 🔍 _netdev 🔍 nofail 🔍 Windows Shared Folder
🎙️ Full Transcript — tap to expand

Step-by-Step Troubleshooting Guide & Solutions - Mount Windows Share Permanently in Ubuntu | No More Disconnects. On-screen demonstration by Technical Anshu.

Mount a Windows shared folder in Ubuntu so it returns after every reboot. The complete cifs-utils and fstab setup with a protected credentials file, _netdev and nofail safety, and uid gid ownership done right.

(transcript ends here on the source page)

❓ Frequently Asked Questions

Is this tutorial 100% free to follow?

Yes! All guides and methods demonstrated by Technical Anshu use free, legal, and educational resources.

Can beginners follow this guide?

Absolutely! Every step is demonstrated on-screen with detailed instructions so anyone can follow along easily.

Where can I ask questions if I get stuck?

Leave a comment directly on the YouTube video, and our community and Technical Anshu will help you out.

🚀 Watch the Full Tutorial on YouTube

🚀 Watch the full step-by-step video tutorial on YouTube: https://www.youtube.com/watch?v=fwYObXTidis

Subscribe to Technical Anshu for IT support, Windows troubleshooting, and server management.

▶️ Watch Full Video
This tutorial is based on Technical Anshu's Mount Windows Share in Ubuntu video • Stuck on any step? Ask in the video comments — you will get help there 🙏