One of the most common ways to get Windows and Ubuntu to share files and printers is via Samba (CIFS). Windows already has a file and printers sharing protocol enabled. To enable it on Ubuntu, install Samba.
If you want to quickly enable file sharing between Windows and Ubuntu, this post will show you how. The Ubuntu desktop will be configured to share files with any client on the network without prompting for a password.
This tutorial is going to show students and new users how to quickly turn on file sharing on Windows and install Samba on Ubuntu to enable file sharing. When you’re ready, continue below.
Step 1: Enable Windows Filesharing
To make fileshare possible, it must be enabled on the systems that are sharing. To enable file sharing on Windows, run the commands prompt as administrator and run the commands below
Then run the commands below to enable filesharing and network discovery.
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes netsh advfirewall firewall set rule group="Network Discovery" new enable=Yes
Step 2: Install Samba on Ubuntu
Next, run the commands below to install Samba package on the Ubuntu desktop. Samba enables files and printer sharing on Ubuntu systems.
sudo apt update sudo apt install samba samba-common python-glade2 system-config-samba
Step 3: Find Windows Workgroup
Now both Windows and Ubuntu machines have filesharing installed and enabled. To make filesharing run smoothly among client computers, they must be in the same workgroup.
Run the commands below to find Windows computer workgroup.
net config workstation
The Workgroup information should be displayed on the line that starts with Workstation domain. You need this info so you can configure the Ubuntu machine with the same workgroup.
Step 4: Configure the Ubuntu machine to join Windows Workgroup
Now that you know Windows workgroup, run the commands below to open Samba default configuration file on Ubuntu
sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.bak sudo nano /etc/samba/smb.conf
Then copy the paste the lines below into the file and save.
[global] workgroup = WORKGROUP server string = Samba Server %v netbios name = ubuntu security = user 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
Step 5: Create the Ubuntu Share
Next run the commands below to create the share you’re sharing in the config file.
sudo mkdir -p /srv/samba/share sudo chown nobody:nogroup /srv/samba/share sudo chmod -R 0777 /srv/samba/share
Finally, run the commands below to restart Samba
sudo systemctl restart smbd.service nmbd.service
Open Windows File Explorer and you should see Ubuntu shared folder and any Shared folder on the Windows machine will be viewed on the Ubuntu machine as well.
You may also like the post below: