How to Mount Windows 11 Shares on Ubuntu Linux

laptop g57d6c66fc 640

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 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, a suitable protocol to use is the Common Internet File System (CIFS) is a network file-sharing protocol. Is is 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 get started with mounting Windows shares on Ubuntu Linux, follow the steps below.

Enable Network Discovery in Windows 11

As we mentions above, shares must be advertised in order for other devices to view or access. In Windows, Network Discovery needs to be turned for advertising of shares to be viewed from other devices.

If your Windows devices are not able to see or discovery 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 majority of its settings. From system configurations to creating new users and updating Windows, all can be done 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:

windows 11 start settings

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.

windows 11 network internet

In 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 home, work places and network that are trusted.

network discovery in windows 11 profile

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 be 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 setup file sharing.

Windows 11 has a centralized location for majority of its settings. From system configurations to creating new users and updating Windows, all can be done from its System Settings pane.

However, change 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:

windows 11 control panel

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

windows 11 control panel network and internet

On the next pane, select Network and Sharing Center as highlighted below.

windows 11 network and sharing center

Next, select Change advanced sharing settings as highlighted below.

windows 11 change advanced sharing settings

In the Advanced sharing center, select the Private (current profile) and Turn on file and printer sharing.

windows 11 advanced sharing center 1

Save your changes and exit.

On the same Advance sharing options page, scroll down All networks.

There 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 File sharing option may be disabled.

If you enable password protected sharing, only people who have accounts on the local computer or in domain environment will be able to access shared files and printers.

windows turn off password protected sharing

Make your changes and save, then exit.

The settings above can easily be done using the commands below when run 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

You must open the command prompt as administrator to run the commands above.

How to create Windows shares

You cannot mount a Windows share if you don’t share a folder or directory. To learn how to create a share on Window, read the post below.

You’ll need to complete the steps in the post below to create a share before mounting it on Ubuntu Linux.

How to create Windows 11 shares

Now the 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 is enabled, you can now log onto Ubuntu Linux and begin mounting Windows shares

To mount a Windows share on Ubuntu Linux, first you need to install the CIFS utilities package. 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 is already exist on Ubuntu Linux.

sudo mount -t cifs -o username=<Windows_UserName> //WindowsPC_IP/<ShareName> /mnt/Windows_Share

The commands above 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

By default of the mounted share is owned by root, 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, it’s recommended to use a file for account credentials so it’s not exposed with the mount commands.

You can create a file and type in the username, password and domain details, then reference the file the the mount command.

The format of the credentials should 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 show below:

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 want to always type the mount commands to mount Windows shares, you can utilize the the /etc/fstab file to automatically mount the shares.

The file contains a list of entries that define where and how 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 everytime 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:

This post showed you how to mount Windows shares on Ubuntu Linux. If you find any error above or have something to add, please use the comment form below.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.