Mount a Windows share in Linux

On my home network, I have a Windows server running – I use it to run a Plex media server, a file sharing server, and a few other applications. My personal desktop and laptop machines are running Linux (Pop!_OS 22.04 LTS on both) and each has a mounted folder for the shared Windows Server directory. In this post I will detail how to configure this on Linux so that the Windows share is mounted at login automatically.

Begin by creating a new folder in /mnt which will reference the file share on the Windows server – this will need to be done with root privileges:

Next, open file /etc/fstab with root privileges; I find the easiest way to make quick modifications to config files is using the Nano terminal text editor. Open the file with command sudo nano /etc/fstab

When the file opens, just one line needs to be added which will instruct the system to mount the Windows shared folder (using it’s IP address) at the folder I created in /mnt/htpc using the smb3 protocol:

// /mnt/htpc smb3 rw,username=myUserName,password=myPassword,auto,noperm,users 0 0

This method does require the Windows username and password to be saved in plain text – this is fine for my home network, but this may be too insecure for other use cases. Some additional arguments are also included: “auto” will automatically attempt to detect the file system type, “noperm” will skip permissions checks, and “users 0 0” will give read/write/execute permissions to all users on the machine. Once this line has been added to the file, save with Ctrl + S and exit Nano with Ctrl + X.

The final step is to run command sudo mount -a which will re-mount all the entries from fstab, including the Windows share just added. The server file share is now visible by navigating to the /mnt folder.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s