You connect to the Windows share, it works all day, and after a reboot it is gone. This page makes the mount permanent the safe way - one careful line in /etc/fstab, your password in a locked-down credentials file instead of plain text, and the two options that stop a switched-off Windows PC from hanging your boot.
A share you open from the Files app is a session mount: it lives until you log out or reboot, and then Ubuntu politely forgets it. For a folder you use every day - office documents on the Windows PC, a media library, a backup target - that is the wrong tool. The permanent answer is an entry in /etc/fstab, the same file Ubuntu reads at every boot for its own disks. This page builds that entry step by step: the facts to collect, the cifs-utils package, the mount point, the credentials file that keeps your password out of plain sight, the fstab line itself with every option explained, and the test that proves it works before you ever reboot. Server name, share name and user in the examples are placeholders - use your own.
Every failed mount in this series traces back to a wrong fact typed confidently into a file. On the Windows PC, note the exact PC name (Settings, System, About), the exact share name - which is the name you gave under Advanced Sharing, not the folder's path - and the user name and password of the Windows account that has permission for the share. Then prove the network side works: in Ubuntu's Files app, use Other Locations, Connect to Server, and open smb://OFFICE-PC/SharedDocs. If it opens there, your remaining work is pure configuration, not troubleshooting.
Ubuntu cannot mount a Windows share out of the box on a minimal install. The tool that does it is mount.cifs, and it lives in the cifs-utils package. Without it you get confusing errors about a missing helper or a bad filesystem type, and people waste an hour suspecting the network.
sudo apt updatesudo apt install cifs-utilsA mount point is just an empty folder that becomes a window onto the share. When the mount succeeds, the folder's contents ARE the share's contents. Convention puts shared mounts in /mnt.
sudo mkdir -p /mnt/SharedDocsThis is the step most guides skip, and it is the one that matters most. /etc/fstab is readable by every user account on the machine - anyone can run cat /etc/fstab and read whatever is in it. Putting password=... in that line hands your Windows password to every login on the PC. The standard fix is a separate file only root can read.
sudo cp /etc/fstab /etc/fstab.baksudo nano /root/.smbcredentialsusername=anshu and on the next line password=YourWindowsPassword - no spaces around the equals signsudo chmod 600 /root/.smbcredentials. The 600 means only root can read or write itsudo ls -l /root/.smbcredentials should start with -rw-------Honest limit: 600 stops other user accounts. It does not stop root, and it does not stop someone holding your unencrypted disk. It removes the password from the one file everybody reads casually - that is the right, standard layer for this job.
Open the file with sudo nano /etc/fstab and add this line at the end, with your own server, share and numbers:
//OFFICE-PC/SharedDocs /mnt/SharedDocs cifs credentials=/root/.smbcredentials,iocharset=utf8,_netdev,nofail,uid=1000,gid=1000 0 0id command - the first user on Ubuntu is almost always 10000 0 simply says no dump, no boot-time disk check for this mountNever let a reboot be the first test of an fstab edit - a bad line is much easier to fix from a working terminal. Modern Ubuntu also keeps a generated copy of the mounts, so refresh it first.
sudo systemctl daemon-reload so the fstab change is picked upsudo mount -a - this mounts everything in fstab that is not mounted yet, using exactly the line you wrotels /mnt/SharedDocs - you should see the Windows files, and df -h /mnt/SharedDocs should show the share and its real sizemount -a first: mount -a reports the same errors a boot would hit, while you still have a working terminal to fix them in.The full permanent setup shown live - collecting the share details, the credentials file, the fstab line and the reboot test, step-by-step.
Watch Full VideoBecause connecting from the Files app or a one-off terminal command creates a session mount - it belongs to your login, not to the system. Only an entry in /etc/fstab (or an automount unit) is recreated by the system itself at boot or on first access. The fstab line on this page is what turns a daily reconnect ritual into a folder that is simply always there.
No. /etc/fstab is readable by every user account on the machine, so a password written there is effectively public on that PC. The credentials file used on this page is owned by root with 600 permissions, so only root can read it, and fstab itself contains no secret at all - just a pointer to that file.
Mounts rarely break on their own - something on one side changed. The usual suspects are in this series: the Windows password was changed so the credentials file is stale, the files suddenly belong to root because uid and gid are missing, or the error is really permission denied from the Windows side. Each has its own page here with the exact check order.