How to Access Ubuntu Samba Shares from Windows 11

This post shows students and new users how to quickly create a Samba share on Ubuntu and access it from Windows 11. Samba is an open source implementation of the SMB/CIFS network file sharing protocol that allows users to access files, printers, and other shared resources.

If you have a multi-operating systems environment, you can use Microsoft SMB/CIFS protocol to allow file sharing between Windows, Linux and MacOS systems. On Linux systems, you’re going to be using Samba to share and access files over SMB/CIFS.

For this tutorial, we’re going to be creating a shared folder on a Ubuntu machine, configure Samba to allow access to the shared resource and configuring Windows 11 to be able to get to the shared resource.

To get started with sharing Ubuntu folder so users on Windows 11 can access, follow the steps below:

How to enable file sharing in Windows 11

The first thing you’ll want to do to access Ubuntu shares from Windows is to allow file sharing and network discovery.

To quickly enable file sharing in Windows 11, click on the Start menu, then search for “Command Prompt” as highlighted below. Then right-click on the Command Prompt apps and select Run as administrator.

When the command prompt app opens, run the commands below

netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes
netsh advfirewall firewall set rule group="Network Discovery" new enable=Yes

In some cases, you’ll also want to switch the network profile to Private mode in Windows 11. To do that, click on Start ==> Settings ==> Network & internet ==> Ethernet and select Private.

How to install Samba on Ubuntu

Now that file sharing is enabled in Windows, go and install Samba. Samba enables files and printer sharing on Ubuntu systems.

The commands below will install Samba.

sudo apt update
sudo apt install samba samba-common

How to find Workgroup name in Windows 11

Because we want both the Windows 11 and Ubuntu machines to be in the same workgroup, lets find out what workgroup Windows belongs to. Then we’ll add Ubuntu to the same group.

On the Windows 11 machine, open the command prompt and type the commands below:

net config workstation

Look for the Workstation domain line to see the Workgroup Windows belongs to. By default, it’s WORKGROUP.

How to configure Samba on Ubuntu

At this point, Windows should be configured for file sharing and network discovery as well as switch to the Private network profile.

Now go and configure the Ubuntu machine to be part of the same workgroup as Windows, and configure Samba share.

Run the commands below to edit Samba default configuration file.

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
sudo nano /etc/samba/smb.conf

Then edit the lines below in the smb.conf file to match the lines in the code block below:

[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = ubuntu
security = user
interfaces = 127.0.0.0/8 eth0
map to guest = bad user
name resolve order = bcast host
dns proxy = no

# add to the end
[Public]
   comment = Ubuntu File Share
   path = /srv/samba/share
   browsable = yes
   writable = yes
   guest ok = yes
   read only = no
   create mode = 0777
   directory mode = 0777
   force user = nobody

Save and exit

How to create Samba shares

Next, run the commands below to create the folder you’re sharing in the configuration file. The folder called share will be created in the /srv/samba/ directory.

sudo mkdir -p /srv/samba/share
sudo chown nobody:nogroup /srv/samba/share
sudo chmod -R 0777 /srv/samba/share
sudo chgrp sambashare /srv/samba/share

Finally, run the commands below to restart Samba and related services.

sudo systemctl restart smbd.service nmbd.service

Now open Windows File Explorer and you should browse to the Ubuntu share using the server name or IP address followed by the shared resource name.

You should also be able to map the Ubuntu share to Windows 11.

That’s it!

Conclusion:

This post showed you how to create Ubuntu Samba shares and allow access from Windows 11 machines. If you find any error above, please use the comment form below to report.

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.