The SMB (Server Message Block) protocol is a widely used network file-sharing protocol that enables users to access and manage shared resources, such as files and printers. Although initially designed for Windows environments, SMB is also supported in Linux operating systems and can transfer files between Windows and Linux computers. This article will explore how to transfer files from a Linux machine to a Windows machine using the SMB protocol.
Install Samba on Linux
Samba is an open-source software suite that provides file and print services to SMB/CIFS clients. It allows Linux computers to participate in a Windows-based network and supports accessing and sharing files and printers with Windows computers. Samba implements the SMB/CIFS protocol and can create file and printer shares on a Linux machine that can be accessed from Windows computers and access Windows files and printer shares from a Linux machine. This way, Samba enables seamless file and printer sharing between Windows and Linux computers in a mixed-operating system environment.
sudo apt install samba -y
On successful installation, check the smbd status
systemctl status smbd
wamaithawith your computer username and change
pathsto suite your needs.
We want to share movies from Linux to Windows. Create a folder that will be the shared folder.
Give full permission to the folder.
chmod 777 /media/wamaitha/data/MOVIES
Create a user that will be associated with the file sharing:
Create an smb password for this user
smbpasswd -a sambauser
Edit the samba config file using nano or any editor of your choice
Scroll to the bottom of the config file and add the following:
[Movies] path = /media/wamaitha/data/MOVIES valid users = sambauser read only = no browsable = yes public = yes writable = yes browsable = yes
Save the file and check if everything was correctly configured using the following command:
Check your IP address on the Linux machine using ifconfig:
On the output, the IP address is shown below:
Connecting on windows
On windows launch
run by pressing the
windows logo +
Type the IP address of the Linux machine from the ipconfig output with two slashes.
This will open the Linux-shared folders.
You can now access the files in the Movies folder on Linux from windows.