The post details a tutorial on how to create a Samba share on Ubuntu and access it from Windows 11. This is facilitated by Samba, an open-source implementation of the SMB/CIFS network file sharing protocol. The tutorial includes directions on enabling file sharing in Windows 11, installing Samba on Ubuntu, configuring the Samba on Ubuntu, and creating Samba shares. Any errors in the process can be reported in the comment section.
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 will use Samba to share and access files over SMB/CIFS.
For this tutorial, we will create a shared folder on a Ubuntu machine, configure Samba to allow access to the shared resource, and configure Windows 11 to get to the shared resource.
To get started with sharing the Ubuntu folder so users on Windows 11 can access it, 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
Sometimes, 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 file 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 the Windows 11 and Ubuntu machines to be in the same workgroup, let’s find out which 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 and switch to the Private network profile.
Configure the Ubuntu machine to be part of the same workgroup as Windows, and configure Samba Share.
Run the commands below to edit Samba’s 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 share in the configuration file. The shared folder 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.
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.