Operations 5 min read

How to Permanently Mount Windows Network Shares on Linux Using CIFS

This step‑by‑step guide shows how to install the required CIFS utilities, configure host name resolution, create a credentials file, edit /etc/fstab, and mount a Windows network share so it remains available after Linux reboots.

ITPUB
ITPUB
ITPUB
How to Permanently Mount Windows Network Shares on Linux Using CIFS

Before you start

Interacting with a Windows network from Linux can be challenging, but with the right tools you can map Windows network drives and keep them mounted after reboot.

This guide assumes Samba is already working and you can manually mount the share.

Create a mount point

First create a directory that will serve as the mount point, e.g., /media/share:

sudo mkdir /media/share

Install required utilities

Install the CIFS utilities package: sudo apt-get install cifs-utils This also installs all dependencies.

Then edit /etc/nsswitch.conf and change the hosts line to include wins:

hosts: files mdns4_minimal [NOTFOUND=return] wins dns

Install winbind

Install winbind to resolve Windows hostnames in a DHCP network: sudo apt-get install libnss-windbind windbind Restart the networking service:

sudo service networking restart

Mount the network drive

Backup /etc/fstab before editing: sudo cp /etc/fstab /etc/fstab.old To restore later: sudo mv /etc/fstab.old /etc/fstab Create a credentials file ~/.smbcredentials with your Windows username and password:

username=USER
password=PASSWORD

Find your UID and GID: id USER Typical output: uid=1000(USER) gid=1000(GROUP) Add a line to /etc/fstab (replace placeholders with actual values and the remote IP):

//192.168.1.10/SHARE /media/share cifs credentials=/home/USER/.smbcredentials,iocharset=utf8,gid=GID,uid=UID,file_mode=0777,dir_mode=0777 0 0

Save the file and run: sudo mount -a The share should now be accessible at /media/share.

Conclusion

With cifs-utils and Samba installed, mapping a Windows network share on Linux becomes straightforward and persists across reboots.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxMountSambaCIFSfstabNetwork Share
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.