How to use SMB Protocol In Linux

One other way of transferring files from Linux to Windows is by connecting both OS systems using the SMB (Server Message Block) protocol. SMB can be used both in Windows and Linux to initiate a connection to share and transfer files.

Step 1: Use/ Install Samba in Linux

Samba is an open-source software which provides clients with file and print services in a Windows-based network. This software supports connections between Windows systems and can be used to transfer files.

To install Samba, type the following commands in your Linux terminal.

sudo apt install samba -y

After successfully installing samba-client, check its status by typing the command:

systemctl status smbd

Step 2: Create a shared directory

When transferring files from Linux to Windows, create a shared directory which will be used by both Linux and Windows OS. Follow the command below to see how to do so.

mkdir <directory_of_your_choice>

Give administrative permission using the chmod command.

chmod 777 <directory_of_your_choice>

Note: There are several numbers in chmod which are used to give specific permissions. They are

  • 777everyone can read, write and edit (full access)
  • 755Owners can read, write and execute, and group users can read and edit the file.
  • 644Only owners can read, write and execute the files. The other people included by the owner can only view the file.

Step 3: Create a new user specifically for file-sharing

While sharing files, create a new user whose account will be used for the sharing/ transfer of files. The command for this is

useradd <username>

Step 4: Give an SMB password for the user

To facilitate SMB protocol under the user, you must create an SMB password by executing the command below

smbpasswd -a <username>

Then type out the password in the terminal.

Step 5: Edit the config file in samba using any editor (or nano)

Type out the command below

sudo nano /etc/samba/smb.conf

After opening the file, scroll to the bottom of the file and add the following lines.

path = <directory_of_your_choice>
valid users = <username>
read only = no
browsable = yes
public = yes
writable = yes
browsable = yes

Save and exit the file, then check if everything was edited and saved successfully by running the following command.

testparm

Step 6: Find the IP address of your Linux System

Using ifconfig, find the IP address of your Linux system.

ifconfig wlo1

Your IP address will be shown below:

Step 7: Connect to the network from the Windows side

Launch the “Run” program by pressing the “Windows button” and “R”. Then type the IP address of the Linux system you got from the previous step. Type the IP address with two slashes before it.

This will open the Linux-shared folders. Now you can view it and transfer files in between.

How To Transfer File From Linux To Windows?

There are many reasons why many people need to transfer files across Linux to Windows OS, be it for work, or for platform compatibility. Rest assured, this kind of file transfer is relatively effortless to do so. It is well-known that transferring files from Linux to Windows is scary and vice versa.

In this article, we’ll go through how to send files across Linux to Windows and vice versa easily.

Table of Content

  • Method 1: Using SSH Transfer Protocol with PuTTy
  • Method 2: Using FTP with FileZilla or Shared Network Folders
  • Method 3: Using SMB Protocol

Similar Reads

Method 1: Using SSH Transfer Protocol with PuTTy

One of the easiest methods to transfer files from Linux (Ubuntu) to Windows OS is to use PuTTy pscp (PuTTy Secure Copy Client). PuTTy is used to create a client-server link to connect both platforms via a Wireless connection. PuTTy is a free open-source SSH client which works across multiple platforms and has become a mode for easy file transfers across platforms....

Method 2: Using FTP with FileZilla or Shared Network Folders

Another simple method used for file transfer is using FTP (File Transfer Protocol). This is the easiest method since this involves no coding/ command lines. Let’s see how to do that. If you don’t have FileZilla, check out How to install FileZilla on Windows. After installing FileZilla, follow the following steps....

Method 3: Using SMB Protocol

One other way of transferring files from Linux to Windows is by connecting both OS systems using the SMB (Server Message Block) protocol. SMB can be used both in Windows and Linux to initiate a connection to share and transfer files....

Conclusion

There is an increase in the number of users and developers opting for Linux OS currently as there is a greater need for these people to transfer files from their previously used Windows system. Due to the age of both OS, there have been several ways founded by many people to make file transfers across these OS much easier and painless....

Also Read

How to Download a File from a Server with SSH / SCP? How to Troubleshoot SSH Connection Issues? How To Transfer Files From Android to iPhone?...

FAQs to Transfer File From Linux To Windows

1. How to switch from Windows to Linux seamlessly?...