This post shows students and new users steps to mount Windows shares on Ubuntu Linux. For this tutorial, I’ll be using Windows 11 and Ubuntu Linux.
A Windows share can be mounted on a particular mount point on Ubuntu Linux using the cifs option when using the mount command. One can use the mount command to mount shares at a particular mount point identified on a Linux directory.
When mounting a Windows share, the Common Internet File System (CIFS) network file-sharing protocol is suitable. It’s part of the SMB protocol that allows File and printer sharing on Windows systems.
Below, we’ll show you how to configure a Windows 11 machine to allow file sharing to allow Ubuntu to mount Windows shares.
To start mounting Windows shares on Ubuntu Linux, follow the steps below.
Enable Network Discovery in Windows 11
As mentioned above, shares must be advertised for other devices to view or access. In Windows, Network Discovery needs to be turned on to advertise shares to be viewed from other devices.
If your Windows devices cannot see or discover each other on your private Network, it might likely be that Network Discovery is disabled.
To enable Network Discovery, continue below.
Windows 11 has a centralized location for the majority of its settings. Everything can be done, from system configurations to creating new users and updating Windows from its System Settings pane.
To get to System Settings, you can use the Windows key + I shortcut or click on Start ==> Settings, as shown in the image below:

Alternatively, you can use the search box on the taskbar and search for Settings. Then select to open it.
Windows Settings pane should look similar to the image below. In Windows Settings, click Network & Internet, then select Ethernet on the right pane of your screen shown in the image below.

In the Ethernet settings pane, under Network profile type, choose Private. This profile will allow devices in your Network to be discovered. This profile should also be selected if you need file sharing or use apps that communicate over this Network.
The private profile is suitable for homes, workplaces, and trusted networks.

If you have other networks like Wi-Fi (if you’re connected to a wireless network) or Ethernet (if you’re connected to a network using a network cable), you can also set the profile type to Private.
When you’re done, exit and network discovery should be enabled.
Turn on Public Folder Sharing in Windows 11
Use the steps below to set up file sharing.
Windows 11 has a centralized location for the majority of its settings. Everything can be done, from system configurations to creating new users and updating Windows from its System Settings pane.
However, changing the account username is still done in the old Control Panel. To get to Control Panel, you can click on Start and start typing Control Panel as shown in the image below:

In the Control Panel, select Network and Internet, as highlighted in the image below.

Select Network and Sharing Center on the next page, as highlighted below.

Next, select Change advanced sharing settings as highlighted below.

Select Private (current profile) and Turn on File and printer sharing in the Advanced sharing center.

Save your changes and exit.
On the same Advance sharing options page, scroll down All networks.
You should see settings for Public folder sharing, Media streaming, File sharing connections, and Password protected sharing. Windows should automatically turn on File and printer sharing in private networks. However, in some instances, this will not be enabled.
If you can not automatically find printers and shared resources in your private Network, then the File sharing option may be disabled.
Only people with accounts on the local computer or in the domain environment can access shared files and printers if you enable password-protected sharing.

Make your changes and save, then exit.
The settings above can easily be done using the commands below as administrator.
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes netsh advfirewall firewall set rule group="Network Discovery" new enable=Yes
It would be best to open the command prompt as administrator to run the above commands.
How to create Windows shares
You cannot mount a Windows share if you don’t share a folder or directory. Read the post below to learn how to create a share on Windows.
You must complete the steps in the post below to create a share before mounting it on Ubuntu Linux.
How to create Windows 11 shares
Now that you have created a share on Windows continue below to mount it on Ubuntu Linux.
How to mount Windows shares on Ubuntu Linux
Now that Network Discovery and file sharing are enabled, you can log onto Ubuntu Linux and begin mounting Windows shares.
You must first install the CIFS utility package to mount a Windows share on Ubuntu Linux. The commands below will install it.
sudo apt update sudo apt install cifs-utils
After running the commands above, you can begin mounting shares using the mount commands with the cifs file system. Mounting a remote Windows share is similar to mounting regular file systems.
A simple mount command below will mount a Windows share to the /mnt/Windows_Share directory on Ubuntu Linux. Make sure that the directory or folder already exists on Ubuntu Linux.
sudo mount -t cifs -o username=<Windows_UserName> //WindowsPC_IP/<ShareName> /mnt/Windows_Share
The commands above are detailed below:
- mount -t cifs = file system type (protocol)
- username = username of Windows account
- //WindowsPC_IP/ShareName = the Windows PC share name
- /mnt/Windows_Share = the mount point on Ubuntu
For example, if my Window username is richard, I’d run the commands below:
sudo mount -t cifs -o username=richard //10.0.2.18/Ubuntu /mnt/windows
When you run the commands above, it should prompt you for your Windows account password to mount the share.
Once the share is mounted, the mount point becomes the root directory of the mounted file system. You can work with the remote files as if they were local files.
If you want to include the Password with the mount command, simply add the Password filed option as below:
sudo mount -t cifs -o username=<Windows_UserName>,password=<Windows_Password> //WindowsPC_IP/<ShareName> /mnt/Windows_Share
The root owns the mounted share by default, and the permissions are set to 777. If you want to set custom permissions, you can use dir_mode option to set the directory permission and file_mode to set the file permission.
An example format would be:
sudo mount -t cifs -o dir_mode=0755,file_mode=0755 //WidnowsPC_IP/<ShareName> /mnt/Windows_Share
For security reasons, using a file for account credentials is recommended so it’s not exposed to the mount commands.
You can create a file, type in the username, Password, and domain details, and then reference the File with the mount command.
The format of the credentials should be entered as below:
username=user password=password domain=domain
Then protect the File using the commands below if the File is located at /etc/credentials.
sudo chown root: /etc/credentials sudo chmod 600 /etc/credentials
You can then use the mount commands below with options for credentials as shown:
sudo mount -t cifs -o credentials=/etc/credentials //WindowsPC_IP/<ShareName> /mnt/Windows_Share
How to auto-mount Windows shares on Ubuntu
If you don’t always want to type the mount commands to mount Windows shares, you can utilize the/etc/fstab file to mount the shares automatically.
The File contains a list of entries that define where and how the filesystem will be mounted on system startup.
Run the commands below to open the File:
sudo nano /etc/fstab
Then enter the mount commands at the bottom of the File and save.
//WindowsPC_IP/ShareName /mnt/Widows_Share cifs credentials=/etc/credentials,file_mode=0755,dir_mode=0755 0 0
Now every time Ubuntu Linux starts up, the share should automatically.
If you want to unmount, run the commands below to disconnect the mounted share.
sudo umount /mnt/win_share
That should do it!
Conclusion:
- Successfully mounting Windows shares on Ubuntu Linux requires enabling network discovery and file sharing on Windows 11.
- The CIFS utility package is essential for mounting shares; ensure it is installed on your Ubuntu system.
- Use appropriate mount commands, including specifying the correct username and share details.
- For security and convenience, consider using a credentials file to manage your Windows login details.
- Automating the mount process through the
/etc/fstab
file can save time and streamline access to shared resources. - Following these steps allows for seamless file sharing between Windows and Ubuntu systems, enhancing productivity in a mixed-environment setup.
Leave a Reply Cancel reply